Irucka Embry
2013-Jan-07 05:09 UTC
[R] function to export multiple results to appended .csv file
Hi, how are you? I have an attached file (StationIDs) that lists 74 observation sites that I need to process using the EGRET/WRTDS R-package. For each site, I need to load information into the Sample, INFO, and Daily fields. The "sitenumber" in the following code refers to one of the 74 observation sites. Is there anyway to process the following commands through a function that exports the set of 74 AnnualResults (each of the 4 season results in order from Fall to Summer) to a .csv file? I would like to thank you in advance. Irucka Embry file <- "nwis_wqdata_sc_n.csv" Sample <- getSampleDataFromFilecustom(file, hasHeader = TRUE, separator =",") Sample <- subset(Sample,station_id==sitenumber) Sample <- subset(Sample, select=c(date, remark, value)) write.csv(Sample, file = "sitenumber_nitrogen.csv") file <- "sitenumber_nitrogen.csv" Sample <- getCustomSampleDataFromFilet(file, hasHeader = TRUE, separator =",") Sample <- subset(Sample,Julian>=55060) Sample <- subset(Sample,Julian<=56520) Sample<-removeDuplicates(Sample) summary(Sample) length(Sample$Date) file <-"info_n.csv" INFO<- getMetaDataFromFile(file) INFO<- subset(INFO,site.no=="sitenumber") file <- "sitenumber.rdb.gz" Daily <- getDailyDataFromFileCustom(file) Daily <- subset(Daily,Julian>=55060) Daily <- subset(Daily,Julian<=56520) summary(Daily) Sample<-mergeReport() modelEstimation(localDaily = Daily,localSample = Sample, localINFO INFO, windowY=10, windowQ=2, windowS=0.5,minNumObs=10,minNumUncen=10, env=parent.frame()) INFO<-setPA(window = 4) annualSeries<-makeAnnualSeries() plotFlowSingle(istat=5) plotFlowSingle(istat=2) printSeries(istat=5) printSeries(istat=2) plotConcTime() AnnualResults<-setupYears() AnnualResults tableResults(localAnnualResults = AnnualResults, localINFO = INFO, qUnit = 1, fluxUnit = 13) yearPoints<-c(2001,2002,2003,2004) tableChange(localAnnualResults = AnnualResults, localINFO = INFO, fluxUnit = 13, yearPoints) AnnualResults<- setupYears(paLong = 3, paStart = 10, localDaily = Daily) AnnualResults AnnualResults<- setupYears(paLong = 3, paStart = 1, localDaily = Daily) AnnualResults AnnualResults<- setupYears(paLong = 3, paStart = 4, localDaily = Daily) AnnualResults AnnualResults<- setupYears(paLong = 3, paStart = 7, localDaily = Daily) AnnualResults <span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2" style="font-size:13.5px">_______________________________________________________________<BR>Get the Free email that has everyone talking at <a href=http://www.mail2world.com target=new>http://www.mail2world.com</a><br> <font color=#999999>Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much More!</font></font></span>