Done! Inside each neat function, there is a line of code where the function checks if df supplied is grouped. If true, then setNames() will conditionally add a column Group, otherwise, NULL. This fixes the issue. When connecting one pipe to another, the groups from the previous pipe get lost, so it must be re-grouped until the end of the workflow like this:
quality <- anthro.01 |>
mw_wrangle_age(
dos = dos,
dob = dob,
age = age,
.decimals = 2
) |>
mw_wrangle_muac(
sex = sex,
age = age,
muac = muac,
.recode_sex = TRUE,
.recode_muac = TRUE,
.to = "cm"
) |>
group_by(area) |>
mw_plausibility_check_mfaz(
flags = flag_mfaz,
sex = sex,
muac = muac,
age = age
) |>
group_by(area) |>
mw_neat_output_mfaz()
# A tibble: 2 × 18
# Groups: Group [2]
Group `Total children` `Flagged data (%)` Class. of flagged da…¹ `Sex ratio (p)`
<chr> <int> <chr> <fct> <chr>
1 Distr… 505 0.0% Excellent 0.593
2 Distr… 686 0.9% Excellent 0.380
# ℹ abbreviated name: ¹`Class. of flagged data`
# ℹ 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>
Done! Inside each neat function, there is a line of code where the function checks if
df
supplied is grouped. If true, thensetNames()
will conditionally add a columnGroup
, otherwise,NULL
. This fixes the issue. When connecting one pipe to another, the groups from the previous pipe get lost, so it must be re-grouped until the end of the workflow like this: