comparison plot-trend.R @ 0:d0ee713d4758 draft default tip

planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
author ecology
date Thu, 20 Jun 2019 04:05:06 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d0ee713d4758
1 #!/usr/bin/env Rscript
2 library(nlme)
3 library(MASS)
4
5 args = commandArgs(trailingOnly=TRUE)
6 input = read.table(args[1], header=TRUE,sep=" ") #input=data.index =ab_index-output
7 load(args[2])
8
9 glmm.mod_fullyear <- glmmPQL(regional_gam~ as.factor(YEAR)-1,data=input,family=quasipoisson,random=~1|SITE, correlation = corAR1(form = ~ YEAR | SITE),verbose = FALSE)
10
11 col.index <- as.numeric(glmm.mod_fullyear$coefficients$fixed)
12 year <- unique(input$YEAR)
13
14 png('output-plot-trend.png')
15 plot(year,col.index, type='o',xlab="year",ylab="collated index")
16 abline(mod,lty=2,col="red")
17 invisible(dev.off())
18
19 d<-data.frame(year,col.index)
20 colnames(d)<-c("year","collated index")
21 write.table(d,"s_trend.tsv",sep=" ",row.names=FALSE)
22
23 cat("Show trend line on abundance plot")