Mercurial > repos > ecology > regionalgam_ab_index
annotate gls.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 |
rev | line source |
---|---|
0
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
2 library(nlme) |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
3 library(MASS) |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
4 |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
5 args = commandArgs(trailingOnly=TRUE) |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
6 input1 = read.table(args[1], header=TRUE) #input1=col.index =glmmpql-output |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
7 input2 = read.table(args[2], header=TRUE,sep=" ") #input2=data.index =abundance_index-output |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
8 |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
9 input1<-as.matrix(input1) |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
10 |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
11 year <- unique(input2$YEAR) |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
12 mod <- gls(input1~year) |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
13 summary<-summary(mod) |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
14 |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
15 save(mod, file = "mod.rda") |
d0ee713d4758
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/regionalgam commit ffe42225fff8992501b743ebe2c78e50fddc4a4e
ecology
parents:
diff
changeset
|
16 capture.output(summary, file="mod-summary.txt") |