export_as_bds: Save donordata format as JSON

View source: R/export_as_bds.R

export_as_bdsR Documentation

Save donordata format as JSON

Description

Converts data in donordata format to a JSON file per child.

Usage

export_as_bds(data, ids, path = NULL, names = NULL, indent = NULL, ...)

Arguments

data

Dataset in donordata format (having child and time elements)

ids

Integer vector with the id number for the individuals

path

Optional. Path where files should be written. By default, path is the working directory. The function creates the path if it doesn't already exist.

names

Optional. Character vector with length(ids) elements used to construct the file name. Spaces are replaced by underscores. If not specified, the function uses the ids vector to create file names.

indent

Optional. Integer. Number of spaces to indent when using jsonlite::prettify(). When not specified, the function writes minified json.

...

Forwarded to write_bds()

Note

If child birth date is unknown, then 2000-01-01 is used. Birth date of the mother is back-calculated from agem, and thus imprecise.

Author(s)

Stef van Buuren 2021

Examples

names <- c("Laura S", "Thomas S")
ids <- as.integer(c(34071, 34072))
## Not run: 
export_as_bds(minidata, ids = ids, names = names, indent = 2)

## End(Not run)

growthcharts/bdsreader documentation built on March 26, 2024, 4:16 a.m.