rapsimng package is designed to modify and run the *.apsimx simulations using R in APSIM Next Generation.
Install from CRAN.
install.packages('rapsimng')
Install the developing version from Github.
devtools::install_github('byzheng/rapsimng')
The wheat.apsimx
in the validation dataset of APSIM NG is used as an example. Function read_apsimx
is used to read *.apsimx
file through jsonlite::read_json
and returns as a list.
# Read Wheat.apsimx file with `read_apsimx` which returns a list of json results.
file <- system.file("wheat.apsimx", package = "rapsimng")
m <- read_apsimx(file)
A node in the apsimx file can be found using the path specification in APSIM NG.
potential <- search_path(m,
path = '[Structure].BranchingRate.PotentialBranchingRate.Vegetative.PotentialBranchingRate')
potential
new_model <- potential$node
new_model$XProperty <- 'NewVariable'
new <- replace_model(m, potential$path, new_model)
write_apsimx(new, tempfile(fileext = '.json'))
A function run_models
is wrapped for APSIM NG Models.exe
in the command line and can be called to run apsimx files. See APSIM website for documentation.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.