Mercurial > repos > mnhn65mo > regionalgam
diff ab_index.R @ 0:5b126f770671 draft
Uploaded
author | mnhn65mo |
---|---|
date | Fri, 03 Aug 2018 08:28:22 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ab_index.R Fri Aug 03 08:28:22 2018 -0400 @@ -0,0 +1,17 @@ +#!/usr/bin/env Rscript +#library("getopt") +#library(devtools) +#library(RegionalGAM) + +args = commandArgs(trailingOnly=TRUE) +source(args[1]) + + +tryCatch({input = read.table(args[2], header=TRUE,sep=" ")},finally={input = read.table(args[2], header=TRUE,sep=",")}) +pheno = read.table(args[3], header=TRUE,sep=" ") + +if("TREND" %in% colnames(input)){ + input <- input[input$TREND==1,c("SPECIES","SITE","YEAR","MONTH","DAY","COUNT")] +} +data.index <- abundance_index(input, pheno) +write.table(data.index, file="data.index", row.names=FALSE, sep=" ")