Learn R Programming

abn (version 3.1.12)

export_to_json: Helper function to convert export list to JSON

Description

Helper function to convert export list to JSON

Usage

export_to_json(export_list, format, file = NULL, pretty = TRUE)

Arguments

export_list

The list to convert to JSON. Must contain variables, parameters, and arcs components, see details.

format

Character string specifying the export format. Currently, only "json" is supported.

file

Optional character string specifying a file path to save the JSON output. If NULL (default), the JSON string is returned.

pretty

Logical, whether to format the JSON output with indentation for readability. Default is TRUE. Set to FALSE for more compact output.

Details

The export_list must be a named list with the following components:

  • scenario_id: Optional identifier for the model run/scenario.

  • label: Optional name/label for the scenario.

  • variables: An array where each element represents a variable/node with its metadata, distribution type, and states (for categorical variables).

  • parameters: An array where each element represents a parameter with its link function, source variable, and coefficients.

  • arcs: An array with arc details, each containing source_variable_id and target_variable_id.