robyn_write: Import and Export Robyn JSON files

View source: R/json.R

robyn_writeR Documentation

Import and Export Robyn JSON files

Description

robyn_write() generates light JSON files with all the information required to replicate Robyn models. Depending on user inputs, there are 3 use cases: only the inputs data, input data + modeling results data, and input data, modeling results + specifics of a single selected model. To replicate a model, you must provide InputCollect, OutputCollect, and, if OutputCollect contains more than one model, the select_model.

Usage

robyn_write(
  InputCollect,
  OutputCollect = NULL,
  select_model = NULL,
  dir = OutputCollect$plot_folder,
  add_data = TRUE,
  export = TRUE,
  quiet = FALSE,
  pareto_df = NULL,
  ...
)

## S3 method for class 'robyn_write'
print(x, ...)

robyn_read(json_file = NULL, step = 1, quiet = FALSE, ...)

## S3 method for class 'robyn_read'
print(x, ...)

robyn_recreate(json_file, quiet = FALSE, ...)

Arguments

InputCollect

robyn_inputs() output.

OutputCollect

robyn_run(..., export = FALSE) output.

select_model

Character. Which model ID do you want to export into the JSON file?

dir

Character. Existing directory to export JSON file to.

add_data

Boolean. Include raw dataset. Useful to recreate models with a single file containing all the required information (no need of CSV).

export

Boolean. Export outcomes into local files?

quiet

Boolean. Keep messages off?

pareto_df

Dataframe. Save all pareto solutions to json file.

...

Additional parameters to export into a custom Extras element.

x

robyn_read() or robyn_write() output.

json_file

Character. JSON file name to read and import.

step

Integer. 1 for import only and 2 for import and output.

Value

(invisible) List. Contains all inputs and outputs of exported model. Class: robyn_write.

Examples

## Not run: 
InputCollectJSON <- robyn_inputs(
  dt_input = Robyn::dt_simulated_weekly,
  json_file = "~/Desktop/RobynModel-1_29_12.json"
)
print(InputCollectJSON)

## End(Not run)

Robyn documentation built on June 27, 2024, 9:06 a.m.