Constructs a standardized data object for use with bdsreader-compatible tools. Returns a list with personal and measurement data. If psn or xyz are not provided, default templates are created.

init_bdsreader(psn = NULL, xyz = NULL)

Arguments

psn

A tibble or data frame containing subject-level information. If NULL, a template is returned.

xyz

A tibble or data frame with long-format measurement data. If NULL, an empty template is returned.

Value

A list of class "bdsreader" with two elements:

psn

A tibble with one row per subject. See details below.

xyz

A tibble in long format with age-based measurements. See details below.

Fields in psn

id

Integer. Unique subject ID. Set to -1 if not provided. Code id == 0 is the current target child

name

Character. Child name or alias.

dob

Date. Date of birth of the child.

dobm

Date. Date of birth of the mother.

dobf

Date. Date of birth of the father.

src

Character. Data source or study identifier.

dnr

Character. Donor or provenance code.

sex

Character. Sex of the child (e.g., "male", "female").

gad

Numeric. Gestational age in days.

ga

Numeric. Gestational age in completed weeks.

smo

Numeric. Smoking status during pregnancy (0 or 1).

bw

Numeric. Birth weight in grams.

hgtm

Numeric. Height of mother in centimeters.

hgtf

Numeric. Height of father in centimeters.

agem

Numeric. Age of mother at birth in years.

etn

Character. Ethnicity code.

pc4

Character. Postal code (NL-style 4-digit format).

blbf

Integer. Birth land biological father (landcode).

blbm

Integer. Birth land biological mother (landcode).

eduf

Integer. Educational level of father.

edum

Integer. Educational level of mother.

par

Integer. Parity (number of previous children).

Fields in xyz

age

Numeric. Age at measurement (e.g., in days or months).

xname

Character. Name of the x-variable (typically "age").

yname

Character. Name of the measurement variable (e.g., "hgt").

zname

Character. Name of the z-score variable. (e.g. "hgt_z")

zref

Character. Reference standard for z-score (e.g., "nl_2010_hgt_male_").

x

Numeric. Value of the x-variable.

y

Numeric. Observed measurement value.

z

Numeric. Standardized z-score.

Examples

bds <- init_bdsreader()
validate_bdsreader(bds)
#> [1] TRUE