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
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 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
indexof()
Find index of needle (value) in haystack (vector)
length_IM()
Length of vector or string
logistic()
Logistic function
logit()
Logit function
rbool()
Generate random logical value
rdist()
Generate random number from custom distribution
rem() mod() `%REM%`
Remainder and modulus
round_IM()
Round Half-Up (as in Insight Maker)

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

clean_name()
Clean variable name(s)
has_internet()
Check if user has internet
nonnegative()
Safely check whether x is less than zero
saveat_func()
Internal function to save dataframe at specific times