Learn R Programming

apsimr (version 1.2)

example_apsim: Access Example APSIM Simulations

Description

Standard APSIM simulations are provided by the default APSIM installation. apsim_example moves those example files into the working directory wd so you can run them or edit them using apsim and edit_apsim, respectively. Generally the example simulations must be moved because the output file is written to the directory containing the .apsim file and the ability to write in the "Program Files" can be limited in some cases.

Usage

example_apsim(path, wd = getwd(), files = NULL, ...)

Arguments

path
path to the APSIM installation
wd
working directory containing the .apsim files to be copied; defaults to the current working directory
files
files to extract from the "Examples" folder
...
additional arguments passed to file.copy

Value

logical; if TRUE the corresponding file was successfully copied, FALSE otherwise

Examples

Run this code
## Not run: 
# apsimPath <-"C:/Program Files (x86)/Apsim75-r3008/"
# apsimWd <- "~/APSIM"
# toRun <- "Canopy.apsim"
# example_apsim(path = apsimPath, wd = apsimWd, files = toRun) #TRUE
# 
# toRun <- c("Canopy.apsim", "Continuous Wheat.apsim")
# example_apsim(path = apsimPath, wd = apsimWd, files = toRun) #TRUE TRUE
# 
# apsimExe <-"C:/Program Files (x86)/Apsim75-r3008/Model/Apsim.exe"
# results <- apsim(exe = apsimExe, wd = apsimWd, files = toRun)
# plot(results[[1]])
# ## End(Not run)

Run the code above in your browser using DataLab