randomise() records where allocation happens in the pipeline without
excluding any rows (n_fail is always 0). as_consort_diagram() and
as_attrition_tibble() use its by/arms to default branch_by when
not explicitly supplied, and steps at or after it are flagged
post_randomisation in as_attrition_tibble()'s output.
Arguments
- criteria
A
cf_criteriaobject (orNULLto start a new one).- by
One or more column names (character vector) naming the randomisation unit (e.g.
"cluster_id"for cluster randomisation, or the participant id for individual randomisation).- arms
A single column name (string) holding each unit's allocated arm (e.g.
"arm").- label
A short human-readable description of this step. Default
"Randomised"(unlike other builders, a label is not required).- category
An optional string grouping this step with others for display.
NULLleaves it uncategorised.
See also
Other criteria builders:
cf_criteria(),
cf_criterion(),
check_criteria(),
exclude(),
group_exclude(),
group_include(),
include(),
select_within()
Examples
cf_criteria() |>
include(~ eligible, label = "Eligible clusters") |>
randomise(by = "cluster_id", arms = "arm") |>
exclude(~ withdrew, label = "Withdrew after allocation")
#> Cohort criteria pipeline (3 steps)
#> 1. [+][~] (include) Eligible clusters
#> eligible
#> 2. [R][-] (randomise) [by: cluster_id] [arms: arm] Randomised
#> <none>
#> 3. [-][~] (exclude) Withdrew after allocation
#> withdrew