Calculate z-scores for weight-for-height (WFHZ) and identify outliers based on the SMART methodology.
Arguments
- df
A dataset object of class
data.frame
to wrangle data from.- sex
A
numeric
orcharacter
vector of child's sex. Code values should only be 1 or "m" for males and 2 or "f" for females. Make sure sex values are coded in either of the aforementioned before to call the function. If input codes are neither of the above, the function will stop execution and return an error message with the type of mismatch.- weight
A vector of class
double
of child's weight in kilograms. If the input is of a different class, the function will stop execution and return an error message indicating the type of mismatch.- height
A vector of class
double
of child's height in centimeters. If the input is of a different class, the function will stop execution and return an error message indicating the type of mismatch.- .recode_sex
Logical. Set to
TRUE
if the values forsex
are not coded as 1 (for males) or 2 (for females). Otherwise, set toFALSE
(default).- .decimals
The number of decimals places the z-scores should have. Default is 3.
Value
A data frame based on df
. New variables named wfhz
and
flag_wfhz
, of child's WFHZ and detected outliers, will be created.
References
SMART Initiative (2017). Standardized Monitoring and Assessment for Relief and Transition. Manual 2.0. Available at: https://smartmethodology.org.
Examples
mw_wrangle_wfhz(
df = anthro.01,
sex = sex,
weight = weight,
height = height,
.recode_sex = TRUE,
.decimals = 2
)
#> ================================================================================
#> # A tibble: 1,191 × 13
#> area dos cluster team sex dob age weight height edema
#> <chr> <date> <int> <int> <dbl> <date> <int> <dbl> <dbl> <chr>
#> 1 District… 2023-12-04 1 3 1 NA 59 15.6 109. n
#> 2 District… 2023-12-04 1 3 1 NA 8 7.5 68.6 n
#> 3 District… 2023-12-04 1 3 1 NA 19 9.7 79.5 n
#> 4 District… 2023-12-04 1 3 2 NA 49 14.3 100. n
#> 5 District… 2023-12-04 1 3 2 NA 32 12.4 92.1 n
#> 6 District… 2023-12-04 1 3 2 NA 17 9.3 77.8 n
#> 7 District… 2023-12-04 1 3 2 NA 20 10.1 80.4 n
#> 8 District… 2023-12-04 1 3 2 NA 27 11.7 87.1 n
#> 9 District… 2023-12-04 1 3 1 NA 46 13.6 98 n
#> 10 District… 2023-12-04 1 3 1 NA 58 17.2 109. n
#> # ℹ 1,181 more rows
#> # ℹ 3 more variables: muac <int>, wfhz <dbl>, flag_wfhz <dbl>