knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

bdsreader

R-CMD-check Lifecycle: stable

The bdsreader package is a lightweight package that

The bdsreader translates child data (incoming via an API request) into a data object useful for R processing. The package is part of Joint Automatic Measurement and Evaluation System (JAMES) developed by the Netherlands Organisation for Applied Scientific Research TNO.

Installation

Install the jamesdemodata and bdsreader packages as

install.packages("remotes")
remotes::install_github("growthcharts/jamesdemodata")
remotes::install_github("growthcharts/bdsreader")

There is no CRAN release of these packages.

Examples

read_bds() and write_bds() are the main functions of the package.

Reading JSON child data

We work with an example dataset maria.json, containing the data of one child, from the jamesdemodata package. Find the filename and show the first 10 lines:

fn <- system.file("json", "examples", "maria.json", package = "jamesdemodata")
cat(paste(readLines(fn, n = 10), collapse = "\n"), "\n...")

The following commands illustrate the use of the `read_bds()`` function:

library(bdsreader)
child <- read_bds(fn)
class(child)

read.bds() returns a bdsreader object. We print it as

child

The object is a list with two elements: psn and zyx:

See ?init_bdsreader for more details on the structure of the bdsreader class.

Writing JSON child data

The write_bds() function perform the inverse operation. By default, it returns minified JSON:

js <- write_bds(child)
cat(paste(js, collapse = "\n"), "\n...")

You can write the data in a pretty format using the indent and to a file using file argument.



growthcharts/bdsreader documentation built on June 9, 2025, 3:37 a.m.