addWGSR {zscorer} | R Documentation |
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.
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
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 |
firstPart |
Name of variable specifying:
Give a quoted variable name as in (e.g.) |
secondPart |
Name of variable specifying:
Give a quoted variable name as in (e.g.) |
thirdPart |
Name of variable specifying age (in days) for BMI/A. Give a
quoted variable name as in (e.g.) |
index |
The index to be calculated and added to
Give a quoted index name as in (e.g.) |
standing |
Variable specifying how stature was measured. If NULL then age
(for |
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 |
digits |
The number of decimal places for |
Value
A data.frame of the survey dataset with the calculated z-scores added.
Examples
# 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")