Process MUAC data
Usage
process_muac_data(
df,
age = "age",
sex = "sex",
sex_recode = NULL,
muac = "muac",
muac_units = c("mm", "cm"),
oedema = "oedema",
oedema_recode = NULL
)
Arguments
- df
A data.frame with information on age, sex, oedema status, and MUAC of each child
- age
A character value for name of variable in
df
for age of child. The age of child should be in months.- sex
A character value for name of variable in
df
for sex of child. The expected values forsex
is 1 = males; 2 = females. If data values are different, usesex_recode
to map out the values to what is required.- sex_recode
A vector of values with length of 2 with the first element for the value signifying males and second element for the value signifying females in the dataset. For example, if "m" is the value for males and "f" is the value for females, then specify
c("m", "f)
. If set to NULL (default), then the values c(1, 2) are used.- muac
A character value for name of variable in
df
for MUAC measurement of child. The expected values for MUAC are in millimetres. If units are different, usemuac_units
to specify which units are used.- muac_units
A character value for units used for MUAC measurement. Currently accepts either "mm" for millimetres (default) or "cm" for centimetres.
- oedema
A character value for name of variable in
df
for oedema status of child. The expected values foroedema
is 1 = for presence of oedema and 2 for no oedema. If data values are different, useoedema_recode
to map out the values to what is required. If dataset does not have oedema values, set this to NULL.- oedema_recode
A vector of values with length of 2 with the first element for the value signifying presence of oedema and second element for the value signifying no oedema in the dataset. For example, if "y" is the value for presence of oedema and "n" is the value for no oedema, then specify
c("y", "n)
. If set to NULL (default), then the values c(1, 0) are used.
Examples
process_muac_data(muac_data)
#> # A tibble: 435 × 6
#> state_name district_name age sex muac oedema
#> <chr> <chr> <int> <int> <dbl> <int>
#> 1 State A District A 7 1 13.3 2
#> 2 State A District A 42 1 13.3 2
#> 3 State A District A 60 1 14.6 2
#> 4 State A District A 60 2 15.6 2
#> 5 State A District A 48 1 13.3 2
#> 6 State A District A 60 2 14.3 2
#> 7 State A District A 18 1 12.4 2
#> 8 State A District A 48 1 14.2 2
#> 9 State A District A 60 2 12.8 2
#> 10 State A District A 36 1 13.4 2
#> # ℹ 425 more rows