addWGSR: Add the WHO Growth Reference z-scores to a data frame of...

Description Usage Arguments Value Examples

View source: R/addWGSR.R

Description

Add the WHO Growth Reference z-scores to a data frame of anthropometric data for weight, height or length, MUAC, head circumference, sub-scapular skinfold and triceps skinfold.

Usage

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

Arguments

data

A survey dataset as a data.frame object

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:

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.

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.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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")

zscorer documentation built on Oct. 30, 2019, 9:43 a.m.