## Not run:
# meanCowpea<-function(X){
# return(mean(X$lai_cowpea))
# }
#
# apsimWd <- "~/APSIM"
# apsimVar <- c(rep("SoilWater/Thickness",11), "SoilOrganicMatter/SoilCN")
# apsimValue <- matrix(c(rep(200, 2), rep(300, 9), 10,
# rep(350, 2), rep(350, 9), 5),nrow=2,byrow=T)
# apsimExe <-"C:/Program Files (x86)/Apsim75-r3008/Model/Apsim.exe"
# apsimFile <- "Canopy.apsim"
#
# #Run APSIM at each new parameter vector specified by apsimVar and only return the mean cowpea value
# uniRes <- apsim_vector(X = apsimValue, exe = apsimExe, wd = apsimWd, vars = apsimVar,
# to.run = apsimFile, to.edit = apsimFile, g = meanCowpea)
# uniRes
#
#
# allCowpea <- function(x){
# return(x$lai_cowpea)
# }
#
# #Use allCowpea function to return all the cowpea values
# multiRes <- apsim_vector(X = apsimValue, exe = apsimExe, wd = apsimWd, vars = apsimVar,
# to.run = apsimFile, to.edit = apsimFile, g = allCowpea)
# multiRes
# ## End(Not run)
Run the code above in your browser using DataLab