Learn R Programming

rapsimng

rapsimng package is designed to modify and run the *.apsimx simulations using R in APSIM Next Generation.

Features

  • Find elements in the *.apsimx file

Crop-specific resources

For crop-specific functions and additional resources, please refer to:

Installation

Install from CRAN.

install.packages('rapsimng')

Install the developing version from Github.

remotes::install_github('byzheng/rapsimng')

Read APSIMX file

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("extdata/wheat.apsimx", package = "rapsimng")
m <- read_apsimx(file)

Search by of APSIM NG

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

Modify a found model

new_model <- potential$node
new_model$XProperty <- 'NewVariable'

Replace the new model

new <- replace_model(m, potential$path, new_model)

Save into a new apsimx file

write_apsimx(new, tempfile(fileext = '.json'))

Run apsimx file

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.

Copy Link

Version

Install

install.packages('rapsimng')

Monthly Downloads

240

Version

0.4.6

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Bangyou Zheng

Last Published

February 9th, 2026

Functions in rapsimng (0.4.6)

new_cultivar

Generate new cultivars with parameter which can be used in Replacements
list_report

List all reports in the database
search_path

Find a model in the apsimx file using specified path
log_level

Set the log level of apsimx file
split_apsimx

Split an APSIMX file into separate simulations except cultivar
with_apsimx

Run APSIM Next Generation Simulations in a Temporary Folder
write_apsimx

Write APSIMX file
set_parameter_value

Set a parameter with a new value
update_cultivar

Title Update the cultivar parameters
test_apsimx

Test whether all files under published folder of apsimx are required
keep_simulations

Keep simulations for a factorial experiment
install_apsimng

Install ApsimNG Software
get_metfile

Get the met file name for an experiment
get_parent

Get the parent node from a path
append_model

append a model into apsimx
get_pawc

Estimate Plant Available Water Capacity (PAWC) from an apsimx file
get_cultivar

Get all cultivar parameters in a model
available_models

List all available models in APSIM NG
insert_models

Insert models into apsimx
insert_model

Insert a model into apsimx
get_simulations

Get simulations for a factorial experiment
disable_models

Disable models in apsimx
remove_model

Remove a model with new values
read_report

Read apsimx database in db file format
new_model

Create a new model
read_apsimx

Read APSIMX file
minimum_apsimng

Create the minimum requirements to run an APSIM Next Generation
replace_model

Replace a model with new values
run_models

Run apsimx file using Models.exe
search_node

Find element(s) in apsimx file