View source: R/csm_create_state.R
| csm_create_state | R Documentation |
Create a cropping systems model (CSM) state variable
csm_create_state(name, definition, units, equation)
name |
a length-one character vector name of a variable |
definition |
a length-one character vector that defines the CSM variable |
units |
a length-one character vector of the units of the CSM variable |
equation |
an R expression with the equation for the rate of change of the CSM state variable |
a list of csm_state objects
# Define state variables with single call
lv_state <- csm_create_state(
c("x", "y"),
definition = c("prey", "predator"),
units = c("rabbits per square km", "foxes per square km"),
expression(~alpha*x-beta*x*y, ~delta*x*y-gamma*y))
# Define state variables with multiple calls
lv_state <-
c(
csm_create_state(
name = "x",
definition = "prey",
units = "rabbits per square km",
equation = ~alpha*x-beta*x*y),
csm_create_state(
name = "y",
definition = "predator",
units = "foxes per square km",
equation = ~delta*x*y-gamma*y)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.