Skip to contents

Building stock-and-flow models

as.data.frame(<sdbuildR_sim>)
Create dataframe of simulation results
as.data.frame(<sdbuildR_xmile>)
Convert stock-and-flow model to dataframe
build()
Create, modify or remove variables
debugger()
Debug stock-and-flow model
find_dependencies()
Find dependencies
get_build_code()
Generate code to build stock-and-flow model
header()
Modify header of stock-and-flow model
macro()
Create, modify or remove a global variable or function
plot(<sdbuildR_xmile>)
Plot stock-and-flow diagram
print(<summary.sdbuildR_xmile>)
Print method for summary.sdbuildR_xmile
summary(<sdbuildR_xmile>)
Print overview of stock-and-flow model
xmile()
Create a new stock-and-flow model

Simulate stock-and-flow models

ensemble()
Run ensemble simulations
export_plot()
Save plot to a file
julia_setup_ok()
Check Julia environment set up
plot(<sdbuildR_ensemble>)
Plot timeseries of ensemble
plot(<sdbuildR_sim>)
Plot timeseries of simulation
sim_specs()
Modify simulation specifications
simulate()
Simulate stock-and-flow model
solvers()
Check or translate between deSolve and Julia DifferentialEquations solvers
use_julia()
Set up Julia environment
use_threads()
Set up threaded ensemble simulations

Insight Maker

insightmaker_to_sfm()
Import Insight Maker model
url_to_IM()
Extract Insight Maker model XML string from URL

Input functions

pulse()
Create pulse function
ramp()
Create ramp function
seasonal()
Create a seasonal wave function
step()
Create step function

Custom functions

contains_IM()
Check whether needle (value) is in haystack (vector or string)
expit()
Expit function
filter_IM()
Filter vector based on logical function
`%REM%`
Remainder operator
indexof()
Find index of needle (value) in haystack (vector)
length_IM()
Length of vector or string
logistic()
Logistic function
logit()
Logit function
mod()
Modulus
rbool()
Generate random logical value
rdist()
Generate random number from custom distribution
rem()
Remainder
round_IM()
Equivalent of Insight Maker's Round() function to R
shuffle()
Shuffle vector
substr_i()
Extract characters from string by index

Delay functions

Units

convert_u()
Convert unit in equation
drop_u()
Drop unit in equation
get_regex_time_units()
Get regular expressions for time units in Julia
get_regex_units()
Get regular expressions for units in Julia
get_units()
View all standard units
model_units()
Create, modify or remove custom units
u()
Specify unit in equations
unit_prefixes()
Show unit prefixes

Internal functions

compare_sim()
Compare two simulations
has_internet()
Check if user has internet
nonnegative()
Safely check whether x is less than zero
not_on_cran()
Check if on CRAN
saveat_func()
Internal function to save dataframe at specific times