The predicate is evaluated per group; groups where the predicate returns
TRUE are removed (all their rows dropped).
Arguments
- criteria
A
cf_criteriaobject (orNULLto start a new one).- by
One or more column names (character vector) to group by; supply more than one for composite (multi-column) grouping.
- predicate
A one-sided formula using summary functions, or a function.
- label
A short human-readable description of this criterion.
- category
An optional string grouping this step with others for display.
NULLleaves it uncategorised.- reason
An optional short description of the rows this step removes, shown in diagram exclusion boxes.
NULL(default) useslabelfor exclusion steps; for inclusion steps it should be set. See the Labels section.
See also
Other criteria builders:
cf_criteria(),
cf_criterion(),
check_criteria(),
exclude(),
group_include(),
include(),
randomise(),
select_within()
Examples
cf_criteria() |>
group_exclude(by = "cluster_id", ~ mean(is.na(age)) > 0.5,
label = "Excessive missing age in cluster")
#> Cohort criteria pipeline (1 step)
#> 1. [-][~] (group_exclude) [by: cluster_id] Excessive missing age in cluster
#> mean(is.na(age)) > 0.5