Learn R Programming

apsimx: R package for APSIM-X (NextGen) and APSIM Classic (7.x)

This package allows for interaction with APSIM-X ("Next Generation") and/or APSIM 'Classic' (7.10). It can inspect, edit, run and read APSIM files in both platforms. The format is JSON for APSIM-X and XML for 'Classic'.

Package requirements

  • Imported R packages: DBI, jsonlite, knitr, RSQLite, tools, utils, xml2

  • Suggested R packages: BayesianTools, chirps, datasets, daymetr, future, ggplot2, GSODR, listviewer, maps, metrica, mvtnorm, nasapower, nloptr, parallely, reactR, rmarkdown, sensitivity, soilDB, sp, spData, sf, ucminf

  • APSIMX:

  • and/or APSIM (7.x) 'Classic'

NOTE ON REQUIREMENTS:

  • Current versions of APSIM Next Gen do not require additional software

to run on Mac or Linux. The dotnet runtime environment is shipped with the image/package.

  • For current versions, on Windows, the 'Microsoft Windows Desktop Runtime' 3.1.14 is required. The installer also updated GTK3 to 3.24.20 during the installation.

  • For older versions of APSIM Next Gen (before Sept 2021) the mono framework was required to run on Mac and Linux (Debian). Mono should be installed first (in Mac and Linux).

If you are running the latest version of APSIM Next Gen, you do not need to install the Mono Framework.

Mono framework download: https://www.mono-project.com/download/stable/

.Net Core download for Mac: https://dotnet.microsoft.com/download

APSIMX download: https://www.apsim.info/download-apsim/

Since APSIM Next Gen 2021.04.01 (at least) .NET framework 4.6 or higher is required for Windows and I have had to update the Mono framework to 6.12 on Mac (again this applies to pre Sep 2021).

If you want to install this package from github try in R:

library(devtools)
devtools::install_github("femiguez/apsimx")
library(apsimx)

or the lightweight 'remotes' package

library(remotes)
remotes::install_github("femiguez/apsimx")
library(apsimx)

It is not necessary to build the vignettes as they are also at: https://femiguez.github.io/apsimx-docs/

Note: Building the vignettes does not require the presence of APSIM-X as I have recently eliminated the APSIM-X dependency.

Still, if you want to build the vignettes, then use this instead of the second line above:

devtools::install_github("femiguez/apsimx", build_vignettes = TRUE, build_opts = c("--no-resave-data", "--no-manual"))

If you do build the vignettes, there is an introduction to the package

vignette("apsimx")

and a document which might help you build your own scripts either in R or other languages

vignette("apsimx-scripts")

If you have any questions contact Fernando E. Miguez (femiguez at iastate.edu)

Some papers that cite this package (updated Jan 15 2026):

41. Zhang, Y.; Ai, P.; Ma, Y.; Fu, Q.; Ma, X. Global Sensitivity Analyses of the APSIM-Wheat Model at Different Soil Moisture Levels. Plants 2025, 14, 2608. https://doi.org/10.3390/plants14172608

40. Catherine Gilbert, German Mandrini, Elhan Ersoz, Nicolas Martin, The seasonal characterization engine, an application for describing environment from the perspective of crop development SoftwareX, Volume 33, 2026, https://doi.org/10.1016/j.softx.2025.102477.

39. Li, Y.; Yao, Y.; Du, M.; Dong, L.; Yuan, J.; Li, G. APSIM NG Model Simulation of Soil N2O Emission from the Dry-Crop Wheat Field and Its Parameter Sensitivity Analysis. Agronomy 2025, 15, 834. https://doi.org/10.3390/agronomy15040834

38. Maas, E. D. v. L., & Sihi, D. (2025). Management alternatives for climate-smart agriculture at two long-term agricultural research sites in the United States: A model ensemble case study. Agronomy Journal, 117, e70146. https://doi.org/10.1002/agj2.70146

37. Marziotte, L., Carcedo, A. J. P., Mayor, L., Prasad, P. V. V., Peraza, J. A., & Ciampitti, I. A. (2025). An in-silico approach exploring sorghum source:sink balance across sorghum hybrids: How many leaves are enough?. Crop Science, 65, e21449. https://doi.org/10.1002/csc2.21449

36. Hosseinpour, S., Pirdashti, H., Kaveh, M. et al. Determination of a Sustainable Management for Rice Production Through a Modeling Approach. Int. J. Plant Prod. 19, 47–64 (2025). https://doi.org/10.1007/s42106-024-00319-x

35. Panelo, J. S., Miguez, F. E., Schnable, P. S., & Salas-Fernandez, M. G. (2025). Crop growth model-enabled genetic mapping of biomass accumulation dynamics in photoperiod-sensitive sorghum. The Plant Genome, 18, e70111. https://doi.org/10.1002/tpg2.70111

34. Intensifying cropping sequences in the US Central Great Plains: an in silico analysis of a sorghum–wheat sequence. Lucia Marziotte, Ana J. P. Carcedo, Daniel Rodriguez, Laura Mayor, V. Vara Prasad, Ignacio A. Ciampitti. Front. Plant Sci., 29 May 2025. https://doi.org/10.3389/fpls.2025.1525128

33. Hangxin Zhou, Yuchen Wei, Mingming Wang, Liujun Xiao, Zhongkui Luo, Enhancing whole-profile soil organic carbon predictions in croplands through a depth-resolved modelling approach. Soil & Environmental Health. Volume 3, Issue 3, 2025. https://doi.org/10.1016/j.seh.2025.100156.

32. Raigne, J. G., Higgins, R. H., Elli, E. F., Archontoulis, S. V., Dutta, S., Miguez, F. E., & Singh, A. K. (2025). Genetic variability in biomass partitioning and surface residue carbon-nitrogen ratios in soybean. Crop Science, 65, e70155. https://doi.org/10.1002/csc2.70155

31. Climate-adaptative management strategies for soybean production under ENSO scenarios in Southern Brazil: An in-silico analysis of crop failure risk. Gabriel Hintz, Ana Carcedo, Luiz Felipe Almeida, Geomar Corassa, Tiago Horbe, Luan Pott, Raí Schwalbert, Trevor Hefley, P.V. Vara Prasad, Ignacio Ciampitti. Agricultural Systems, Volume 222, 2025, https://doi.org/10.1016/j.agsy.2024.104153.

30. Assessing yield stability of pearl millet and rice cropping systems across West Africa using long-term experiments and a modeling approach. Louis Kouadio, Kristina Fraser, Ali Ibrahim, Kazuki Saito, Fatondji Dougbedji, Kalimuthu Senthilkumar. Published: May 27, 2025. https://doi.org/10.1371/journal.pone.0317170

29. A Modeling Approach for Quantifying the Ecosystem Services of Managed Prairie Systems Osterloh, Marissa. Iowa State University ProQuest Dissertations & Theses, 2025. 31934073.

28. Abebe, T.M.; Degefie, D.T.; Abera, W.; Liben, F.M.; Mkuhlani, S. (2025) Integrating legume-based systems into wheat monoculture: Agronomic and soil fertility impacts in the southeastern highlands of Ethiopia. CGIAR Sustainable Farming Science Program. 28 p.

27. Quantifying Ecosystem Service Trade-Offs to Advance Sustainable Intensification of U.S. Corn Belt Agriculture. Magala, Richard. Iowa State University ProQuest Dissertations & Theses, 2025. 31935615.

26. Ecohydrological Modeling of the Novel Perennial Ground Cover (PGC) System Olowoyeye, Oluwatuyi S. Iowa State University ProQuest Dissertations & Theses, 2025.32117403.

25. Current and future adaptation potential of heat-tolerant maize in Cameroon: a combined attribution and adaptation study. Lennart Jansen, Sabine Undorf and Christoph Gornott. DOI: 10.1088/1748-9326/ada459

24. Enhancing Management Strategies for Crop Yield Improvement via Advanced Data-Informed Decisions van Versendaal Pirez, Emmanuela. Kansas State University ProQuest Dissertations & Theses, 2025. 31937010.

23. Simulating within-field spatial and temporal corn yield response to nitrogen with APSIM model. Thompson et al. (2024). https://doi.org/10.1007/s11119-024-10178-1

22. APSIM NG Model Simulation of Soil N2O Emission from the Dry-Crop Wheat Field and Its Parameter Sensitivity Analysis. Li et al. (2025). https://doi.org/10.3390/agronomy15040834

21. An in-silico approach exploring sorghum source:sink balance across sorghum hybrids: How many leaves are enough? Marziotte et al. (2025). https://doi.org/10.1002/csc2.21449

20. Changes in the leaf area-seed yield relationship in soybean driven by genetic, management and environments: implications for high-throughput phenotyping. Chiozza et al. (2024). https://doi.org/10.1093/insilicoplants/diae012

19. Identifying environments for canola oil production under diverse seasonal crop water stress levels. Correndo et al. (2024) https://doi.org/10.1016/j.agwat.2024.108996

18. PACU: Precision agriculture computational utilities. dos Santos and Miguez. https://doi.org/10.1016/j.softx.2024.101971

17. Determination of a Sustainable Management for Rice Production Through a Modeling Approach. Hosseinpour et al. (2025). https://doi.org/10.1007/s42106-024-00319-x

16. weatherOz: An API Client for Australian Weather and Climate Data Resources in R. Pires et al. (2024). DOI: 10.21105/joss.06717

15. A cost-effective approach to estimate plant available water capacity. Gajurel et al. (2024). https://doi.org/10.1016/j.geoderma.2024.116794

14. van Versendaal et al. Integrating Field Data and a Modeling Approach to Inform Optimum Planting Date × Maturity Group for Soybeans under Current and Future Weather Conditions in Kansas. Sustainability 2023, 15(2), 1081; https://doi.org/10.3390/su15021081

13. R. H. K. Rathnappriya et al. Global Sensitivity Analysis of Key Parameters in the APSIMX-Sugarcane Model to Evaluate Nitrate Balance via Treed Gaussian Process. Agronomy 2022, 12(8), 1979; https://doi.org/10.3390/agronomy12081979

12. Francisco Palmero, Ana J.P. Carcedo, Ricardo J. Haro, Ezequiel D. Bigatton, Fernando Salvagiotti, Ignacio A. Ciampitti. Modeling drought stress impacts under current and future climate for peanut in the semiarid pampas region of Argentina. Field Crops Research. 2022. https://doi.org/10.1016/j.fcr.2022.108615.

11. Elsa Lagerquist, Iris Vogeler, Uttam Kumar, Göran Bergkvist, Marcos Lana, Christine A. Watson, David Parsons, Assessing the effect of intercropped leguminous service crops on main crops and soil processes using APSIM NG. Agricultural Systems. 2024. https://doi.org/10.1016/j.agsy.2024.103884.

10. Daniel Pasquel, Davide Cammarano, Sébastien Roux, Annamaria Castrignanò, Bruno Tisseyre, Michele Rinaldi, Antonio Troccoli, James A. Taylor. Downscaling the APSIM crop model for simulation at the within-field scale, Agricultural Systems. 2023. https://doi.org/10.1016/j.agsy.2023.103773.

9. Tommaso Tadiello, Mara Gabbrielli, Marco Botta, Marco Acutis, Luca Bechini, Giorgio Ragaglini, Andrea Fiorini, Vincenzo Tabaglio, Alessia Perego. A new module to simulate surface crop residue decomposition: Description and sensitivity analysis. Ecological Modelling. Volume 480. 2023. https://doi.org/10.1016/j.ecolmodel.2023.110327.

8. Lopez-Cruz, M., Aguate, F.M., Washburn, J.D. et al. Leveraging data from the Genomes-to-Fields Initiative to investigate genotype-by-environment interactions in maize in North America. Nat Commun 14, 6904 (2023). https://doi.org/10.1038/s41467-023-42687-4

7. Ignacio Massigoge, Ana Carcedo, Jane Lingenfelser, Trevor Hefley, P.V. Vara Prasad, Dan Berning, Sara Lira, Carlos D. Messina, Charles W. Rice, Ignacio Ciampitti. Maize planting date and maturity in the US central Great Plains: Exploring windows for maximizing yields. European Journal of Agronomy. Volume 149. 2023. https://doi.org/10.1016/j.eja.2023.126905.

6. Yang, Xuening and Zhang, Xuanze and Zhao, Zhigan and Ma, Ning and Tian, Jing and Xu, Zhenwu and Zhang, Junmei and Zhang, Yongqiang, Rainfall and Maximum Temperature are Dominant Climatic Factors Influencing Apsim-Maize Cultivar Parameters Sensitivity in Semiarid Regions. Available at SSRN: https://ssrn.com/abstract=4693866 or http://dx.doi.org/10.2139/ssrn.4693866

5. Determining site-specific corn nitrogen rate over time with APSIM model. L.J. Thompson, S. Archontoulis, and L.A. Puntel. https://doi.org/10.3920/978-90-8686-947-3_138

4. Kheir, A. M. S., Mkuhlani, S., Mugo, J. W., Elnashar, A., Nangia, V., Devare, M., & Govind, A. (2023). Integrating APSIM model with machine learning to predict wheat yield spatial distribution. Agronomy Journal, 115, 3188–3196. https://doi.org/10.1002/agj2.21470

3. Acceptability and Evaluation of APSIM-Qryza for Promoting Water and Nitrogen Productivity in Paddy Fields. Shayan Hosseinpour, Hemmatollah Pirdashti, Mohammad Kaveh, Hamze Dokoohaki. https://doi.org/10.21203/rs.3.rs-2677879/v1

2. Augmenting agroecosystem models with remote sensing data and machine learning increases overall estimates of nitrate-nitrogen leaching. Matthew Nowatzke, Luis Damiano, Fernando E Miguez, Gabe S McNunn, Jarad Niemi, Lisa A Schulte, Emily A Heaton and Andy VanLoocke. 20 October 2022. Environmental Research Letters, Volume 17, Number 11 DOI: 10.1088/1748-9326/ac998b

1. Laurent, A., Cleveringa, A., Fey, S. et al. Late-season corn stalk nitrate measurements across the US Midwest from 2006 to 2018. Sci Data 10, 192 (2023). https://doi.org/10.1038/s41597-023-02071-9

Copy Link

Version

Install

install.packages('apsimx')

Monthly Downloads

898

Version

2.8.271

License

GPL-3

Maintainer

Fernando Miguez

Last Published

July 13th, 2026

Functions in apsimx (2.8.271)

get_apsimx_json

fetches the json file for a specific model from APSIMX github
extract_values_apsimx

Extract values from a parameter path
get_iem_apsim_met

Get weather data from Iowa Environmental Ag Weather Stations
get_iemre_apsim_met

Get weather data from Iowa Environmental Mesonet Reanalysis
get_worldmodeler_apsim_met

Obtain a weather APSIM met from the World Modeler database
compare_apsim_met

Compare two or more ‘met’ files
compare_apsim

Compare two or more apsim output objects
get_slga_soil

Retrieve soil profile data from SLGA (Soils for Australia)
edit_apsimx_replacement

Edit a replacement component in an .apsimx (JSON) file
get_chirps_apsim_met

Get CHIRPS data for an APSIM met file
get_daymet2_apsim_met

Get DAYMET data for an APSIM met file
extract_data_apsimx

Extract data from an .apsimx (JSON) file
get_worldmodeler_soil_profile

Obtain a synthetic APSIM soil profile from the World Modeler database
grep_json_list

grep but for json list
get_ssurgo_tables

Retrieve soil profile data and return a (list) with data frames (tables)
get_ssurgo_soil_profile

Retrieve soil profile data and convert it to an object of class ‘soil_profile’
get_isric_soil_profile

Generate a synthetic APSIM soil profile from the ISRIC soil database
mcmc.apsimx.env

Environment to store data for apsimx MCMC
napad_apsim_met

Pad a met file with NAs when there are date discontinuities
get_slga_soil_profile

Generate a synthetic APSIM soil profile from the SLGA soil database
impute_apsim_met

Perform imputation for missing data in a met file
insert_replacement_node

Inserts a replacement node in a simple apsimx simulation file
inspect_apsimx_replacement

Inspect a replacement component in an .apsimx (JSON) file
mcmc.apsim.env

Environment to store data for apsim MCMC
initialwater_parms

Helper function to supply additional Initial Soil Water parameters
plot.met

Plot method for object of class ‘met’
inspect_apsimx

Inspect an .apsimx (JSON) file
inspect_apsimx_json

Inspect an .apsimx or .json (JSON) file
get_power_apsim_met

Get NASA-POWER data for an APSIM met file
inspect_apsim

Inspect an .apsim (XML) file
inspect_apsim_xml

Inspect an APSIM Classic auxiliary (XML) file
optim_apsimx

Optimize parameters in an APSIM Next Generation simulation
plot.carbon.stocks

Plot carbon stocks (function in progress)
print.met

Printer-friendly version of a metfile
[.met

Extract or Replace Part of a ‘met’ object
read_apsim_all

Read all APSIM generated .out files in a directory
optim_apsim

Optimize parameters in an APSIM simulation
read_apsim

Read APSIM generated .out files
read_apsim_met

Read in an APSIM met file
sens_apsim

Sensitivity Analysis for APSIM Next Generation simulation
obsWheat

Observed wheat phenology, LAI and biomass
read_apsim_soils

Read in a soils (XML) file into a list of ‘soil_profile’ objects
soilwat_parms

Helper function to supply SoilWat parameters
soilorganicmatter_parms

Helper function to supply additional Soil Organic Matter parameters
sens_apsimx

Sensitivity Analysis for APSIM Next Generation simulation
unit_conv

performs common unit conversions
summary.met

Summary for an APSIM met file
tt_apsim_met

Calculates Thermal Time taking a ‘met’ object
view_apsimx

Viewing an APSIM-X file interactively
view_apsim

Viewing an APSIM Classic file interactively
view_apsim_xml

View an APSIM Classic auxiliary (XML) file
read_apsimx_all

Read all APSIM-X generated .db files in a directory
read_apsimx

Read APSIM-X generated .db files
solutes_parms

Helper function to supply additional Solute parameters
xargs_apsimx

Provide extra arguments for APSIM-X
wop.h

Wheat example optimization results plus Hessian
write_apsim_met

Write an APSIM met file
wop

Wheat example optimization results
tav_apsim_met

Calculates attribute amp for an object of class ‘met’
swim_parms

Helper function to supply SWIM parameters
ssurgo2sp

Take in SSURGO csv files and create a soil profile
apsimx_example

Access Example APSIM-X Simulations
apsimx

Run an APSIM-X simulation
apsim_options

Setting some options specific to APSIM (7.x) ‘Classic’
apsim_example

Access Example APSIM Simulations
apsim

Run an APSIM (7.x) ‘Classic’ simulation
amp_apsim_met

Calculates attribute amp for an object of class ‘met’
apsim_version

Display available APSIM ‘Classic’ and APSIM-X versions
apsimx.options

Environment which stores APSIM-X options
apsim.options

Environment which stores APSIM options
add_column_apsim_met

Add a column to an object of class ‘met’
apsimx_filetype

Test file format for .apsimx files
auto_detect_apsimx_examples

Auto detect where apsimx examples are located
carbon_stocks

Calculate soil carbon stocks
check_apsim_met

Check a met file for possible errors
available_water_content

Calculate available water content
auto_detect_apsim_examples

Auto detect where apsim examples are located
as_apsim_met

Conversion from data frame to met object
apsimx_soil_profile

Create APSIM-X Soil Profiles
apsimx_options

Setting some options for the package
check_apsimx

Partial checking of an apsimx file for possible issues.
edit_apsim_xml

Edit an APSIM (Classic) Simulation auxiliary xml file
edit_apsim

Edit an APSIM (Classic) Simulation
doy2date

Converts from doy to date
edit_apsim_replace_soil_profile

Edit APSIM ‘Classic’ file with a replaced soil profile
edit_apsimx

Edit an APSIM-X (JSON) Simulation
edit_apsimx_replace_soil_profile

Edit APSIM-X file with a replaced soil profile
edit_apsimx_batch

Edit an APSIM-X (JSON) Simulation in Batch mode
compare_apsim_soil_profile

Compare two or more soil profiles
get_daymet_apsim_met

Get DAYMET data for an APSIM met file
get_gsod_apsim_met

Get GSOD data for an APSIM met file