Skip to contents

Import a stock-and-flow model from Insight Maker. Models may be your own or another user's. Importing causal loop diagrams or agent-based models is not supported.

Usage

import_insightmaker(
  url,
  file,
  keep_nonnegative_flow = TRUE,
  keep_nonnegative_stock = FALSE
)

Arguments

url

URL to Insight Maker model. Character.

file

File path to Insight Maker model. Only used if url is not specified. Needs to be a character with suffix .InsightMaker or .json.

keep_nonnegative_flow

If TRUE, keeps original non-negativity setting of flows. Defaults to TRUE.

keep_nonnegative_stock

If TRUE, keeps original non-negativity setting of stocks. Defaults to FALSE.

Value

A stock-and-flow model object of class stockflow.

Details

Insight Maker models can be imported using a URL, Insight Maker file, or ModelJSON file. Ensure the URL refers to a public (not private) model. To download a model file from Insight Maker, first clone the model if it is not your own. Then, go to "Share" (top right), "Export", and "Download Insight Maker file" or "ModelJSON File".

See also

Examples

# Load a model from Insight Maker
sfm <- import_insightmaker(
  url =
    "https://insightmaker.com/insight/43tz1nvUgbIiIOGSGtzIzj/Romeo-Juliet"
)
plot(sfm)
# Simulate the model sim <- simulate(sfm) plot(sim)