flag_who: Apply World Health Organization (WHO) anthropometric z-score...

View source: R/flag_who.R

flag_whoR Documentation

Apply World Health Organization (WHO) anthropometric z-score indices flagging criteria

Description

Flagging is a process of checking whether values of anthropometric indices are outside a given range and recording the result in one or more new variables. The result may be a set of logical (i.e. 1/0 or true/false) flag variables (i.e. one flag variable per anthropometric index) or a single variable holding a code number that classifies the nature of the detected problem(s).

Usage

flag_who(df, hlaz = NULL, waz = NULL, whlz = NULL, verbose = TRUE, add = TRUE)

flag_zscore(x = NULL, z = c("hlaz", "whlz", "waz"))

Arguments

df

A data.frame containing anthropometric z-score indices for height-for-age or length-for-age, weight-for-age, and/or weight-for-height or weight-for-length.

hlaz

A character value indicating the variable name in df for the height-for-age or length-for-age z-score.

waz

A character value indicating the variable name in df for the weight-for-age z-score.

whlz

A character value indicating the variable name in df for the weight-for-height or weight-for-length z-score.

verbose

Logical. Should an additional flag description be returned? Default is TRUE.

add

Logical. Should flag values be added to df. Default is TRUE.

x

A numeric value or vector of numeric values for height-for-age z-score (haz) and/or length-for-age z-score (laz), weight-for-height z-score (whz) and/or weight-for-length z-score (wlz), or weight-for-age z-score (waz).

z

A character value for type of z-score value provided. Can be one of either hlaz for height-for-age or length-for-age z-score, whlz for weight-for-height or weight-for-length z-score, or waz for weight-for-age z-score. If no value selected, will default to hlaz.

Details

The WHO flagging criteria are simple biologically plausible ranges. If, for example, a value for weight-for-height z-score is below -5 or above +5 then the record is flagged to indicate a likely problem with weight-for-height z-score. This will usually be caused by an erroneous weight or height value being recorded.

Value

Returns df with additional column named flag containing coded values indicating problematic measurements and a column named flag_description containing text describing which anthropometric measurement/s are likely problematic. If add FALSE and verbose FALSE, returns a vector of flag coded values indicating problematic measurements. if add FALSE and verbose TRUE, returns a data.frame with a column named flag containing coded values indicating problematic measurements and a column named flag_description containing text describing which anthropometric measurement/s are likely problematic.

A numeric value or vector of values indicating whether a z-score value/s is/are flagged. For height-for-age or length-for-age z-score, this will be values of either 0 or 1 with a value of 0 indicating that z-score value is not flagged and a value of 1 indicating that z-score value is flagged. For weight-for-height or weight-for-length z-score, this will be values of either 0 or 2 with a value of 0 indicating that z-score value is not flagged and a value of 2 indicating that z-score value is flagged. For weight-for-age z-score, this will be values of either 0 or 4 with a value of 0 indicating that z-score value is not flagged and a value of 4 indicating that z-score value is flagged.

Author(s)

Ernest Guevarra

Ernest Guevarra

Examples

flag_who(df = zscorer::anthro1, hlaz = "haz", waz = "waz", whlz = "whz")

## Check if a single height-for-age or length-for-age z-score value is
## within WHO recommended limits
flag_zscore(x = zscorer::anthro1$haz[1], z = "hlaz")

## Check if a vector of height-for-age and length-for-age z-score values are
## within WHO recommended limits
flag_zscore(x = zscorer::anthro1$haz, z = "hlaz")

## Check if a single weight-for-height or weight-for-length z-score value is
## within WHO recommended limits
flag_zscore(x = zscorer::anthro1$whz[1], z = "whlz")

## Check if a vector of weight-for-height and weight-for-length z-score
## values are within WHO recommended limits
flag_zscore(x = zscorer::anthro1$whz, z = "whlz")

## Check if a single weight-for-age z-score value is within WHO recommended
## limits
flag_zscore(x = zscorer::anthro1$waz[1], z = "waz")

## Check if a vector of weight-for-age z-score values are within WHO
## recommended limits
flag_zscore(x = zscorer::anthro1$waz, z = "waz")


nutriverse/nutricheckr documentation built on April 1, 2022, 7:44 p.m.