Package 'zscorer'

Title: Child Anthropometry z-Score Calculator
Description: A tool for calculating z-scores and centiles for weight-for-age, length/height-for-age, weight-for-length/height, BMI-for-age, head circumference-for-age, age circumference-for-age, subscapular skinfold-for-age, triceps skinfold-for-age based on the WHO Child Growth Standards.
Authors: Mark Myatt [aut, cph] , Ernest Guevarra [aut, cre]
Maintainer: Ernest Guevarra <[email protected]>
License: AGPL-3
Version: 0.3.1.9000
Built: 2024-11-02 03:12:29 UTC
Source: https://github.com/nutriverse/zscorer

Help Index


Anthropometric data from a SMART survey in Kabul, Afghanistan.

Description

Anthropometric data from a SMART survey in Kabul, Afghanistan.

Usage

anthro1

Format

A data frame with 873 observations and 11 variables

Variable Description
psu Primary sampling unit
age Age of child (months)
sex Gender of child
weight Weight of child (kgs)
height Height of child (cm)
muac Mid-upper arm circumference (mm)
oedema Presence or absence of oedema
haz Height-for-age z-score
waz Weight-for-age z-score
whz Weight-for-height z-score
flag Data quality flag

Examples

head(anthro1)

Anthropometric data from a single state from a Demographic and Health Survey (DHS) of a West African country.

Description

Anthropometric data from a single state from a Demographic and Health Survey (DHS) of a West African country.

Usage

anthro2

Format

A data frame with 796 observations and 6 variables

Variable Definition
psu Primary sampling unit
age Age (months)
sex Gender
wt Weight (kg)
ht Height (cm)
oedema Presence or absence of oedema

Examples

head(anthro2)

Anthropometric data from a Rapid Assessment Method (RAM) survey from Burundi.

Description

Anthropometric data from a Rapid Assessment Method (RAM) survey from Burundi.

Usage

anthro3

Format

A data frame with 221 observations and 7 variables

Variable Definition
psu Primary sampling unit
age Age (months)
sex Gender
weight Weight (kg)
height Height (cm)
muac Mid-upper arm circumference (cm)
oedema Presence or absence of oedema

Examples

head(anthro3)

A subset of mid-upper arm circumference data from study conducted to create MUAC-for-age z-scores

Description

A subset of mid-upper arm circumference data from study conducted to create MUAC-for-age z-scores

Usage

anthro4

Format

A data.frame with 257 observations and 4 variables

Variable Definition
pk_serial Unique identifier
muac Mid-upper arm circumference in centimetres
agemons Age in months
sex Sex; 1 = Male; 2 = Female

Source

Mramba Lazarus, Ngari Moses, Mwangome Martha, Muchai Lilian, Bauni Evasius, Walker A Sarah et al. A growth reference for mid upper arm circumference for age among school age children and adolescents, and validation for mortality: growth curve construction and longitudinal cohort study BMJ 2017; 358 :j3423 https://doi.org/10.1136/bmj.j3423

Examples

head(anthro4)

Calculate z-scores for WHZ, HAZ, WAZ using the WHO Growth Reference (2006) for a single child data.

Description

Calculate z-scores for WHZ, HAZ, WAZ using the WHO Growth Reference (2006) for a single child data.

Usage

getAllWGS(data = NULL, sex, weight, height, age, index)

Arguments

data

Data frame containing corresponding data on sex, weight, height, and age of children. Default is NULL. If specified, parameters for sex, weight, height and age should be provided as character values of the names of variables in data corresponding to the parameters required.

sex

Either numeric values (1 = male; 2 = female) indicating sex of child (default) or character value (if data is specified) indicating variable name in data containing information on sex of child/children (1 = male; 2 = female).

weight

Either numeric values for weight in kg with at least 1 decimal place (default) or character value (if data is specified) indicating variable name in data containing information on weight of child/children.

height

Either numeric values for height in cm with at least 1 decimal place (default) or character value (if data is specified) indicating variable name in data containing information on height of child/children.

age

Either numeric values for age in whole months (default) or character value (if data is specified) indicating variable name in data containing information on age of child/children.

index

One of "wfh", "hfa", "wfa" (specifies the required index) or "all" to calculate all three indices

Value

Either a single numeric value for z-score of the anthropometric index selected if data is for single child or a data frame of numeric values for z-scores of each anthropometric index if data is for multiple children and more than one anthropometric index selected.

The function fails messily when secondPart is outside of the range given in the WGS reference (i.e. 45 to 120 cm for height and 0 to 60 months for age). It is up to you to check the ranges of your data.

The reference data for W/H assumes supine length is used for children with a standing height below 85cm

Heights should be specified in cm to the nearest mm (i.e. to 1 d.p.)

Ages should be specified in whole months

Weights should be specified in kg to available precision

The function requires reference data wgsData included in this package

Examples

# apply getAllWGS to a make believe 52 month old male child with weight of
  # 14.6 kg and height of 98.0 cm
  waz <- getAllWGS(sex = 1,        # 1 = Male / 2 = Female
                   weight = 14.6,  # Weight in kilograms
                   height = 98,    # Height in centimetres
                   age = 52,       # Age in whole months
                   index = "wfa")  # Anthropometric index (weight-for-age)
  waz

  haz <- getAllWGS(sex = 1,
                   weight = 14.6,
                   height = 98,    # Height in centimetres
                   age = 52,
                   index = "hfa")  # Anthropometric index (height-for-age)
  haz

  whz <- getAllWGS(sex = 1,
                   weight = 14.6,
                   height = 98,
                   age = 52,
                   index = "wfh")  # Anthropometric index (weight-for-height)
  whz

  # apply getAllWGS to anthro1 dataset
  waz <- getAllWGS(data = anthro1,
                   sex = "sex",
                   weight = "weight",
                   height = "height",
                   age = "age",
                   index = "wfa")
  waz

  haz <- getAllWGS(sex = anthro1$sex,
                   weight = anthro1$weight,
                   height = anthro1$height,
                   age = anthro1$age,
                   index = "hfa")
  haz

  all <- getAllWGS(data = anthro1,
                   sex = "sex",
                   weight = "weight",
                   height = "height",
                   age = "age",
                   index = "all")
  all

Calculate CDC Growth Reference z-score for given anthropometric measurement/s.

Description

The first function, getCDC(), is usually called by the addCDC() function but could be used as a stand-alone calculator for getting z-score for a given anthropometric measurement.

Usage

getCDC(sex, firstPart, secondPart, thirdPart = NA, index = NA, standing = NA)

addCDC(
  data,
  sex,
  firstPart,
  secondPart,
  thirdPart = NA,
  index = NA,
  standing = NULL,
  output = paste(index, "z", sep = ""),
  digits = 2
)

Arguments

sex

A vector specifying the sex of the subject or a character value for the name of the variable in data specifying the sex of the subject. This must be coded as 1 = male and 2 = female. Give a quoted variable name as in (e.g.) "sex".

firstPart

A vector or a character value for the name of the variable in data specifying:

  • Weight (kg) for BMI/A, W/A, W/H, or W/L

  • Head circumference (cm) for HC/A

  • Height (cm) for BMI/A for H/A

  • Length (cm) for L/A

If name of variable in data, give a quoted variable name as in (e.g.) "weight". Be careful with units (weight in kg; height, length, head circumference in cm).

secondPart

A vector or a character value for the name of variable in data specifying:

  • Age (days) for H/A, HC/A, or L/A

  • Height (cm) BMI/A or W/H

  • Length (cm) for W/L

If name of variable in data, give a quoted variable name as in (e.g.) "age". Be careful with units (age in months; height and length in cm).

thirdPart

A vector or a character value for the name of variable in data specifying age (in months) for BMI/A. If name of variable in data, give a quoted variable name as in (e.g.) "age". Be careful with units (age in months).

index

The index to be calculated. One of:

Index Definition
bfa BMI for age
hca Head circumference for age
hfa Height for age
lfa Length for age
wfa Weight for age
wfh Weight for height
wfl Weight for length

Give a quoted index name as in (e.g.) "wfh".

standing

A vector or a character value for name of variable in data specifying how stature was measured. If NULL then age (for "hfa" or "lfa") or height rules (for "wfh" or "wfl") will be applied. This must be coded as 1 = Standing; 2 = Supine; 3 = Unknown. All other values will be recoded to 3 = Unknown. If name of variable in data, give a quoted variable name as in (e.g.) "measured" or a single value (e.g. ⁠"measured = 1⁠). If no value (or NULL) is specified then age rules will be applied.

data

A survey dataset as a data.frame object

output

The name of the column containing the specified index to be added to the dataset. This is an optional parameter. If you do not specify a value for output then the added column will take the name of the specified index with a "z" appended.

digits

The number of decimal places for output. Defaults to 2 d.p.

Details

addCDC() adds the CDC Growth Reference z-scores to a data frame of anthropometric data for weight, height or length, head circumference, and body mass index (BMI)

Value

A data.frame of the survey dataset with the calculated z-scores added.

Examples

# Given a male child 10 months old with a weight of 5.7 kgs, height of 64.2
# cms, and MUAC of 125 mm:
#
# Calculate weight-for-height
getCDC(sex = 1,
       firstPart = 5.7,
       secondPart = 64.2,
       index = "wfh",
       standing = 3)

# calculate weight-for-age
getCDC(sex = 1,
       firstPart = 5.7,
       secondPart = 10,
       index = "wfa",
       standing = 3)

# calculate height-for-age
getCDC(sex = 1,
       firstPart = 64.2,
       secondPart = 10,
       index = "hfa",
       standing = 3)

# Calculate weight-for-height (wfh) for the anthro3 dataset
addCDC(data = anthro3,
       sex = "sex",
       firstPart = "weight",
       secondPart = "height",
       index = "wfh")

# Calculate weight-for-age (wfa) for the anthro3 dataset
addCDC(data = anthro3,
       sex = "sex",
       firstPart = "weight",
       secondPart = "age",
       index = "wfa")

# Calculate height-for-age (hfa) for the anthro3 dataset
addCDC(data = anthro3,
       sex = "sex",
       firstPart = "height",
       secondPart = "age",
       index = "hfa")

Calculate z-scores for WHZ, HAZ, WAZ using the WHO Growth Reference (2006) for a cohort or sample of children.

Description

Calculate z-scores for WHZ, HAZ, WAZ using the WHO Growth Reference (2006) for a cohort or sample of children.

Usage

getCohortWGS(data, sexObserved, firstPart, secondPart, index)

Arguments

data

Data frame containing the variables needed for calculation

sexObserved

Sex of child (1 = Male; 2 = Female)

firstPart

Weight (kg; for WHZ and WAZ) or height (cm; for HAZ)

secondPart

Age (months; for HAZ and WAZ) or height (cm; for WHZ)

index

One of "wfh", "hfa", "wfa" (specifies the required index)

Value

Numeric vector of z-scores of the anthropometric index selected

The function fails messily when secondPart is outside of the range given in the WGS reference (i.e. 45 to 120 cm for height and 0 to 60 months for age). It is up to you to check the ranges of your data.

The reference data for W/H assumes supine length is used for children with a standing height below 85cm

Heights should be specified in cm to the nearest mm (i.e. to 1 d.p.)

Ages should be specified in whole months

Weights should be specified in kg to available precision

The function requires reference data wgsData included in this package

Examples

# apply getWGS to first child in sample data anthro1
  wazAll <- getCohortWGS(data = anthro1,
                         sexObserved = "sex",
                         firstPart = "weight",
                         secondPart = "age",
                         index = "wfa")
  wazAll

  hazAll <- getCohortWGS(data = anthro1,
                         sexObserved = "sex",
                         firstPart = "height",
                         secondPart = "age",
                         index = "hfa")
  hazAll

  whzAll <- getCohortWGS(data = anthro1,
                         sexObserved = "sex",
                         firstPart = "weight",
                         secondPart = "height",
                         index = "wfh")
  whzAll

Calculate z-scores for WHZ, HAZ, WAZ using the WHO Growth Reference (2006) for a single child data.

Description

Calculate z-scores for WHZ, HAZ, WAZ using the WHO Growth Reference (2006) for a single child data.

Usage

getWGS(sexObserved, firstPart, secondPart, index)

Arguments

sexObserved

Sex of child (1 = Male; 2 = Female)

firstPart

Weight (in kg for WHZ and WAZ) or height (in cm for HAZ)

secondPart

Age (in months for HAZ and WAZ) or height (in cm for WHZ)

index

One of "wfh", "hfa", "wfa" (specifies the required index)

Value

z-score of the anthropometric index selected

Warning

The function fails messily when secondPart is outside of the range given in the WGS reference (i.e. 45 to 120 cm for height and 0 to 60 months for age). It is up to you to check the ranges of your data.

Reminders

The reference data for W/H assumes supine length is used for children with a standing height below 85cm

Heights should be specified in cm to the nearest mm (i.e. to 1 d.p.)

Ages should be specified in whole months

Weights should be specified in kg to available precision

The function requires reference data wgsData included in this package

Note

This is a legacy function from the first CRAN release of zscorer which focused mainly on the calculation of z-scores for weight-for-age, weight-for-height and height-for-age. This function has been kept in the package to ensure that existing analysis workflows implemented using the function continue to work.

Examples

# apply \code{getWGS()} to a make believe 52 month old male child with
  # weight of 14.6 kg and height of 98.0 cm
  waz <- getWGS(sexObserved = 1,     # 1 = Male / 2 = Female
                firstPart = 14.6,    # Weight in kilograms
                secondPart = 52,     # Age in whole months
                index = "wfa")       # Anthropometric index (weight-for-age)
  waz

  haz <- getWGS(sexObserved = 1,
                firstPart = 98,      # Height in centimetres
                secondPart = 52,
                index = "hfa")       # Anthropometric index (height-for-age)
  haz

  whz <- getWGS(sexObserved = 1,
                firstPart = 14.6,
                secondPart = 98,
                index = "wfh")       # Anthropometric index (weight-for-height)
  whz

Calculate WHO Growth Reference z-score for given anthropometric measurement/s.

Description

The first function, getWGSR(), is usually called by the addWGSR() function but could be used as a stand-alone calculator for getting z-score for a given anthropometric measurement.

Usage

getWGSR(sex, firstPart, secondPart, thirdPart = NA, index = NA, standing = NA)

addWGSR(
  data,
  sex,
  firstPart,
  secondPart,
  thirdPart = NA,
  index = NA,
  standing = NULL,
  output = paste(index, "z", sep = ""),
  digits = 2
)

Arguments

sex

Name of variable specifying the sex of the subject. This must be coded as 1 = male and 2 = female. Give a quoted variable name as in (e.g.) "sex".

firstPart

Name of variable specifying:

  • Weight (kg) for BMI/A, W/A, W/H, or W/L

  • Head circumference (cm) for HC/A

  • Height (cm) for BMI/A for H/A

  • Length (cm) for L/A

  • MUAC (cm) for MUAC/A

  • Sub-scapular skinfold (mm) for SSF/A

  • Triceps skinfold (mm) for TSF/A

Give a quoted variable name as in (e.g.) "weight". Be careful with units (weight in kg; height, length, head circumference, and MUAC in cm, skinfolds in mm).

secondPart

Name of variable specifying:

  • Age (days) for H/A, HC/A, L/A, MUAC/A, SSF/A, or TSF/A

  • Height (cm) BMI/A or W/H

  • Length (cm) for W/L

Give a quoted variable name as in (e.g.) "age". Be careful with units (age in days; height and length in cm).

thirdPart

Name of variable specifying age (in days) for BMI/A. Give a quoted variable name as in (e.g.) "age". Be careful with units (age in days).

index

The index to be calculated and added to data. One of:

Index Definition
bfa BMI for age
hca Head circumference for age
hfa Height for age
lfa Length for age
mfa MUAC for age
ssa Sub-scapular skinfold for age
tsa Triceps skinfold for age
wfa Weight for age
wfh Weight for height
wfl Weight for length

Give a quoted index name as in (e.g.) "wfh".

standing

Variable specifying how stature was measured. If NULL then age (for "hfa" or "lfa") or height rules (for "wfh" or "wfl") will be applied. This must be coded as 1 = Standing; 2 = Supine; 3 = Unknown. All other values will be recoded to 3 = Unknown. Give a quoted variable name as in (e.g.) "measured" or a single value (e.g. ⁠"measured = 1⁠). If no value (or NULL) is specified then height and age rules will be applied.

data

A survey dataset as a data.frame object

output

The name of the column containing the specified index to be added to the dataset. This is an optional parameter. If you do not specify a value for output then the added column will take the name of the specified index with a "z" appended.

digits

The number of decimal places for output. Defaults to 2 d.p.

Details

addWGSR() adds the WHO Growth Reference z-scores to a data frame of anthropometric data for weight, height or length, MUAC, head circumference, sub-scapular skinfold, triceps skinfold, and body mass index (BMI).

Value

A data.frame of the survey dataset with the calculated z-scores added.

Examples

# Given a male child 10 months old with a weight of 5.7 kgs, height of 64.2
# cms, and MUAC of 125 mm:
#
# Calculate weight-for-height
getWGSR(sex = 1,
        firstPart = 5.7,
        secondPart = 64.2,
        index = "wfh",
        standing = 3)

# calculate weight-for-age
getWGSR(sex = 1,
        firstPart = 5.7,
        secondPart = 10,
        index = "wfa",
        standing = 3)

# calculate height-for-age
getWGSR(sex = 1,
        firstPart = 64.2,
        secondPart = 10,
        index = "hfa",
        standing = 3)

# Calculate MUAC-for-age z-score for a girl
getWGSR(sex = 1,
        firstPart = 20,
        secondPart = 62 * (365.25 / 12),
        index = "mfa")

# Calculate weight-for-height (wfh) for the anthro3 dataset
addWGSR(data = anthro3,
        sex = "sex",
        firstPart = "weight",
        secondPart = "height",
        index = "wfh")

# Calculate weight-for-age (wfa) for the anthro3 dataset
addWGSR(data = anthro3,
        sex = "sex",
        firstPart = "weight",
        secondPart = "age",
        index = "wfa")

# Calculate height-for-age (hfa) for the anthro3 dataset
addWGSR(data = anthro3,
        sex = "sex",
        firstPart = "height",
        secondPart = "age",
        index = "hfa")

# Calculate MUAC-for-age (mfa) for the anthro4 dataset

## Convert age in anthro4 from months to days
testData <- anthro4
testData$age <- testData$agemons * (365.25 / 12)

addWGSR(data = testData,
        sex = "sex",
        firstPart = "muac",
        secondPart = "age",
        index = "mfa")

A subset of data from the National Health and Nutrition Examination Survey

Description

A subset of data from the National Health and Nutrition Examination Survey

Usage

nhanes

Format

A data.frame with 339 observations and 10 variables

Variable Definition
cid Unique child identifier
sex Sex of child. 1 = male; 2 = female
agemos Age in months
weight Weight in kilograms
height Height in centimetres
headcir Head circumference in centimetres
waz Weight-for-age z-score
bmiz BMI-for-age z-score

Examples

head(nhanes)

Initialise built-in Shiny application

Description

Initialise built-in Shiny application

Usage

run_zscorer()

Examples

if(interactive()) run_zscorer()

World Health Organization (WHO) Growth Reference (2006) data

Description

World Health Organization (WHO) Growth Reference (2006) data

Usage

wgsData

Format

A data frame with 6 columns and 2338 rows.

Variable Description
indicator One of weight-for-age (waz), height-for-age (haz), or weight-for-height (whz) anthropometric indicators
sex Sex of child (1 = Male; 2 = Female)
given Variable to which standardisation is to be made. For waz and haz, given is age in months. For whz, given is height in cm
l L component of the LMS method for normalising growth centile standards. L is the trend in the optimal power to obtain normality
m M component of the LMS method for normalising growth centile standards. M is the trend in the mean
s S component of the LMS method for normalising growth centile standards. S is the trend in the coefficient of variation

Source

World Health Organization. WHO Child Growth Standards: Length/Height-for-age, Weight-for-age, Weight-for-length, Weight-for-height, and Body Mass Index-for age: Methods and Development. 1st ed. World Health Organization; 2006.

Examples

head(wgsData)

Deprecated functions in zscorer

Description

These functions still work but will be removed (defunct) in the next version.

Details