Returns the dataset remaining after all exclusion criteria have been
applied. When arms are defined via stratify(), the result
is either a single combined data.table or a named list of
per-arm data.table objects. Data mode only.
Arguments
- .flow
A
selectaobject created in data mode (datasupplied toenroll()).- split
Logical. If
TRUEand arms are defined, return a named list ofdata.tables (one per arm). DefaultFALSEreturns a single combineddata.table.- arm
Character. Name of a specific arm to extract. If supplied, returns only that arm's
data.table.
Value
A data.table containing the participants remaining after
all exclusion criteria. When split = TRUE, a named list of
data.tables (one per arm). When arm is specified, a
single-arm data.table.
Details
cohort() replays the exclusion criteria of a data-mode flow
against the original dataset and returns the rows that survive to the
end, so the analyst can pass the exact analyzed population to downstream
modeling. It requires a flow created by supplying data to
enroll(); manual-mode flows carry only counts and therefore
raise an error. For an unsplit flow the result is a single
data.table; after stratify() or allocate(),
split = TRUE returns one table per arm and arm extracts a
single named arm. To inspect the cohort at every intermediate step rather
than only the end, use cohorts().