knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
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.
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.
read_bds()
and write_bds()
are the main functions of the package.
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
:
psn
element contains the person-level information;xyz
element contains time-varying measurements for the child.See ?init_bdsreader
for more details on the structure of the bdsreader
class.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.