Clean and format the output table returned from the MFAZ plausibility check for improved clarity and readability
Source:R/plausibility_check_mfaz.R
mw_neat_output_mfaz.Rd
Clean and format the output table returned from the MFAZ plausibility check for improved clarity and readability. It converts scientific notations to standard notations, round values and rename columns to meaningful names.
Value
A data frame of the same length and width as df
, with column names and
values formatted for clarity.
Examples
## First wrangle age data ----
data <- mw_wrangle_age(
df = anthro.01,
dos = dos,
dob = dob,
age = age,
.decimals = 2
)
## Then wrangle MUAC data ----
data_mfaz <- mw_wrangle_muac(
df = data,
sex = sex,
age = age,
muac = muac,
.recode_sex = TRUE,
.recode_muac = TRUE,
.to = "cm"
)
#> ================================================================================
## Then run plausibility check ----
pl <- mw_plausibility_check_mfaz(
df = data_mfaz,
flags = flag_mfaz,
sex = sex,
muac = muac,
age = age
)
## Now neat the output table ----
mw_neat_output_mfaz(df = pl)
#> # A tibble: 1 × 17
#> `Total children` `Flagged data (%)` `Class. of flagged data` `Sex ratio (p)`
#> <int> <chr> <fct> <chr>
#> 1 1191 0.5% Excellent 0.297
#> # ℹ 13 more variables: `Class. of sex ratio` <chr>, `Age ratio (p)` <chr>,
#> # `Class. of age ratio` <chr>, `DPS (#)` <dbl>, `Class. of DPS` <chr>,
#> # `Standard Dev* (#)` <dbl>, `Class. of standard dev` <chr>,
#> # `Skewness* (#)` <dbl>, `Class. of skewness` <fct>, `Kurtosis* (#)` <dbl>,
#> # `Class. of kurtosis` <fct>, `Overall score` <dbl>, `Overall quality` <fct>