APSIM Next Generation

The Agricultural Production Systems sIMulator ('APSIM') is a widely used to simulate the agricultural systems for multiple crops. This package is designed to create, modify and run 'apsimx' files in the 'APSIM' Next Generation < https://www.apsim.info/>.


rapsimng

R-CMD-check

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.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rapsimng")

0.6.0 by Bangyou Zheng, 2 months ago


https://rapsimng.bangyou.me/, https://github.com/byzheng/rapsimng


Report a bug at https://github.com/byzheng/rapsimng/issues


Browse source code at https://github.com/cran/rapsimng


Authors: Bangyou Zheng [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports jsonlite, tibble, magrittr, dplyr, purrr, rlang, DBI, RSQLite, tidyweather

Suggests testthat, knitr, rmarkdown, tidyverse, methods


Imported by apsimwise.


See at CRAN