apsim_example: Access Example APSIM Simulations

View source: R/apsim_classic.R

apsim_exampleR Documentation

Access Example APSIM Simulations

Description

simple function to run some of the built-in APSIM examples

Usage

apsim_example(example = "Millet", silent = FALSE, tmp.dir = NULL)

Arguments

example

run an example from built-in APSIM. Options are all of the ones included with the APSIM distribution, except ‘Graph’.

silent

whether to print standard output from the APSIM execution

tmp.dir

temporary directory where to write files

Details

This function creates a temporary copy of the example file distributed with APSIM to avoid writing a .out file to the directory where the ‘Examples’ are located. It is not a good practice and there is no guarantee that the user has read/write permissions in that directory.

Value

This function returns a data frame with APSIM output

Note

This function creates a new column ‘Date’ which is in the R ‘Date’ format which is convenient for graphics.

Examples

## Not run: 
## Only run these if you have APSIM 'Classic' installed (Windows only)
millet <- apsim_example("Millet")
potato <- apsim_example("Potato")
sugar <- apsim_example("Sugar")
## The 'Date' column is created by this function, based on apsim output.
require(ggplot2)
ggplot(data = millet , aes(x = Date, y = millet_biomass)) + 
  geom_line()

## End(Not run)


apsimx documentation built on Sept. 11, 2024, 5:42 p.m.