view ab_index.R @ 2:0e7066603eab draft default tip

Uploaded
author mnhn65mo
date Mon, 06 Aug 2018 04:45:49 -0400
parents 5b126f770671
children
line wrap: on
line source

#!/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="	")