set_refcodes: Calculates a name for a growth references for each...

View source: R/set_refcodes.R

set_refcodesR Documentation

Calculates a name for a growth references for each measurement

Description

Determines the reference name for each measurement based on age, sex, outcome and gestational age.

Usage

set_refcodes(data)

Arguments

data

Data frame in the long form, where each measurement has its own row. Required variables are xname, yname, x and sex. Optional variables are age and ga.

Details

The present implementation uses three Dutch references: a term reference, a pre-term reference for children born ga <= 36 aged 0 - 4 years, and a reference for the D-score. For head circumference, pre-term references up to 1.5 years are used, and term references thereafter. Together, this specification defines the analysis metric in JAMES.

The pre-term references govern gestational ages between 25 and 36 weeks. The function scores pre-term born infants with gestational ages between 21 and 24 weeks relative to the 25-week references.

If the variable ga is not present in data, the function assumes term births for all children and prints a message.

References for the Development Score (D-score) for pre-term were created by shifting the term reference by 40 - ga weeks to the right, so the references start at a later calender age. Because pre-terms are older their Z-score initially score higher than those of terms. The effect disappears after four months.

The yname field currently supports the following measurements: hgt (length/height in cm), wgt (body weight in kg), hdc (head circumference in cm), bmi (body mass index in kg/m**2), wfh (weight for height in kg) and dsc (D-score).

The xname field currently supports the following measurements: age (child age, decimal years) and hgt (height in cm, only for wfh).

Value

A character vector of nrow(data) elements.

Author(s)

Stef van Buuren 2021

References

D-score adjustment for pre-terms

See Also

centile::make_refcode(), centile::load_reference()

Examples

df <- data.frame(
  xname = c("age", "age", "age", "age", "hgt", "age", "age"),
  yname = c("hgt", "hgt", "hdc", "hdc", "wfh", "dsc", "wgt"),
  x = c(0.1, NA, 0.1, 1.6, 60, 1.0, 1.0),
  sex = c(rep(c("male", "female"), 3), "male"),
  ga = c(39, 27, 27, 27, 39, 40, 40))
refcodes <- set_refcodes(df)

# show the preterm 27 weeks hgt reference
centile::load_reference(refcodes[2], pkg = "nlreferences")

growthcharts/nlreferences documentation built on Aug. 27, 2023, 1:25 a.m.