Import and convert a stock-and-flow model from Insight Maker to a .json file. Models may be your own or another user's. Importing causal loop diagrams or agent-based models is not supported.
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.
- destfile
Output file path. Must have extension .json or no extension. Overwrites file if it already exists. If not provided, return model in json format.
Value
If destfile is not provided; object of class "json". If destfile provided, invisibly returns destfile (character string).
Details
Insight Maker models can be imported using a URL or Insight Maker 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".
Examples
# Convert a model from Insight Maker to json
destfile <- tempfile(fileext = ".json")
json <- insightmaker_to_json(
url =
"https://insightmaker.com/insight/43tz1nvUgbIiIOGSGtzIzj/Romeo-Juliet",
destfile = destfile
)
file.remove(destfile)
#> [1] TRUE