Create, modify or remove a global variable or function
macro.Rd
Macros are global variables or functions that can be used throughout your stock-and-flow model. macro()
adds, changes, or erases a macro.
Arguments
- sfm
Stock-and-flow model, object of class sdbuildR_xmile.
- name
Name of the macro. The equation will be assigned to this name.
- eqn
Equation of the macro. A character vector. Defaults to "0.0".
- doc
Documentation of the macro. Defaults to "".
- change_name
New name for macro (optional). Defaults to NULL to indicate no change.
- erase
If TRUE, remove macro from the model. Defaults to FALSE.
See also
Other build:
as.data.frame.sdbuildR_sim()
,
as.data.frame.sdbuildR_xmile()
,
build()
,
debugger()
,
find_dependencies()
,
get_build_code()
,
header()
,
plot.sdbuildR_xmile()
,
print.summary.sdbuildR_xmile()
,
summary.sdbuildR_xmile()
,
xmile()
Examples
# If the logistic() function did not exist, you could create it yourself:
sfm <- macro(xmile(), "func", eqn = "function(x, slope = 1, midpoint = .5){
1 / (1 + exp(-slope*(x-midpoint)))
}")