#-1. Run the second row of some csv file, using only entries in
# columns 2, 3 and 4. Note that all column names in the .csv
# file must be documented in the definition file, and that the
# definition file must be in the current working directory!
runmaespa(2, runfile="runfiletest.csv", runit=FALSE, whichcols=2:4)
#-2. Run all rows and all parameters from a comma-separated file.
runresults <- maesparunall(runfile="runfiletest.csv")
#-3. Look at first run:
summary(runresults$daily[[1]])
#-4. Summarize across runs with statements like these.
# Sum net photosynthesis across runs:
sapply(runresults$daily, function(dfr)sum(dfr$netPs))
#-5. Or write all results to disk:
filenames <- paste("MaespaDailyresults",1:length(runresults$daily),".txt",sep="")
for(f in 1:length(filenames)){
write.table(runresults$daily[[f]],filenames[f],sep=" ",row.names=FALSE)
}
#-6. Use different executable:
runmaespa(executable="othermaestra.exe")
#-7. Or set this other executable as the default for the rest of the session,
# so that you only need to set it once (until you restart R anyway).
formals(runmaespa)$executable <- "othermaestra.exe"
#-8. Specify additional output files to read and save:
myrun <- maestrarunall(runfile="myrunfile.csv", extrafiles=c("layflx.dat","resp.dat"))
# These two files are then available in the 'myrun' list by names 'layflx' and 'resp'.
Run the code above in your browser using DataLab