Write out a Dataset JSON file
Arguments
- x
datasetjson object
- file
File path to save Dataset JSON file
- pretty
If TRUE, write with readable formatting. Note: The Dataset JSON standard prefers compressed formatting without line feeds. It is not recommended you use pretty printing for submission purposes.
- float_as_decimals
If TRUE, Convert float variables to "decimal" data type in the JSON output. This will manually convert the numeric values using the
format()
function using the number of digits specified indigits
, bypassing theyyjsonr
handling of float values and writing the numbers out as JSON character strings. See the Dataset JSON user guide for more information. Defaults to FALSE- digits
When using
float_as_decimals
, the number of digits to use when writing out floats. Going higher than 16 may start writing otherwise sufficiently precise decimals (i.e. .2) to long strings.
Examples
# Write to character object
ds_json <- dataset_json(
iris,
item_oid = "IG.IRIS",
name = "IRIS",
dataset_label = "Iris",
columns = iris_items
)
js <- write_dataset_json(ds_json)
# Write to disk
if (FALSE) { # \dontrun{
write_dataset_json(ds_json, "path/to/file.json")
} # }