Learn R Programming

sdbuildR (version 2.0.0)

insightmaker_to_json: Convert .InsightMaker file to .json file

Description

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.

Usage

insightmaker_to_json(url, file, destfile = NULL)

Value

If destfile is not provided; object of class "json". If destfile provided, invisibly returns destfile (character string).

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.

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

Run this code
if (FALSE) { # has_internet() && Sys.getenv("NOT_CRAN") == "true"
# 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)
}

Run the code above in your browser using DataLab