export_json: Export a 'predx' data frame as a 'predx'-formatted JSON file

Description Usage Arguments Value Examples

View source: R/export_json.R

Description

Export a predx data frame as a predx-formatted JSON file

Usage

1
export_json(x, filename = NA, overwrite = F)

Arguments

filename

character. Filename to write JSON file. If NA, JSON is returned.

overwrite

boolean. Overwrite the file if it already exists.

forecast

A predx data frame.

Value

Silently saves a predx-formatted JSON if filename is specified. Otherwise returns a string in the format of the predx JSON.

Examples

1
2
3
4
5
6
7
8
predx_demo <- as.predx_df(list(
 location = c('Mercury', 'Venus', 'Earth'),
 target = 'habitability',
 predx = list(Binary(1e-4), Binary(1e-4), Binary(1))
))
json_tempfile <- tempfile()
export_json(predx_demo, json_tempfile)
import_json(json_tempfile)

cdcepi/predx documentation built on Dec. 29, 2019, 4:58 p.m.