View source: R/apsim_classic.R
apsim_example | R Documentation |
simple function to run some of the built-in APSIM examples
apsim_example(example = "Millet", silent = FALSE, tmp.dir = NULL)
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 |
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.
This function returns a data frame with APSIM output
This function creates a new column ‘Date’ which is in the R ‘Date’ format which is convenient for graphics.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.