Description Usage Arguments Value Examples
View source: R/write_rise_json.R
write_rise_json()
takes the json character object and writes the data to
the specified location. RISE requires a file format named
sourceCode_YYYYMMDDHHMMSSMS.json, so this function creates a file following
that naming convention. sourceCode
is a field that exists in the json
character object, so it is used for the file name.
1 | write_rise_json(x, path)
|
x |
json character vector. Likely output from |
path |
File path to save the file to. Should be an existing directory. |
Invisibly returns x
. Saves x
to path
as .json file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ifile <- system.file(
'extdata/Scenario/ISM1988_2014,2007Dems,IG,Most',
"KeySlots.rdf",
package = "RWDataPlyr"
)
# get the tbl using RWDataPlyr
rwtbl <- RWDataPlyr::rdf_to_rwtbl2(
ifile,
scenario = "test",
keep_cols = rwtbl_cols_for_rise
)
# manually specify some parameters:
ui_vars <- list(
sourceCode = "CRSS-TestData",
modelNameSourceCode = "CRSS",
status = "Finalized Dec. 2012. To RISE v0.0.1",
modelRunDescription = "desc"
)
# get the rest of the parameters automatically
rise_tbl <- rwtbl_add_rise_vars(rwtbl, ui_vars)
# and then convert to the RISE json format
rise_json <- tbl_to_rise_json(rise_tbl)
# finally write the file
write_rise_json(rise_json, path = tempdir())
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.