Package: cohortflow 0.0.0.9017

cohortflow: Define and Apply Cohort Inclusion/Exclusion Criteria

Define inclusion and exclusion criteria for cohort studies using formulas or functions, apply them to data, and render the resulting attrition flow as CONSORT flow diagrams, tables, or narrative text. Supports hierarchical designs (participants nested in clusters/sites) and flexible grouping for reporting. Criteria pipelines can be serialised to YAML for reproducibility and sharing. Parts of this package were developed with the assistance of GitHub Copilot (powered by Claude), an AI coding assistant.

Authors:Matthew Moore [aut, cre], Health Research Council of New Zealand [fnd]

cohortflow_0.0.0.9017.tar.gz
cohortflow_0.0.0.9017.zip(r-4.7-any)cohortflow_0.0.0.9017.zip(r-4.6-any)cohortflow_0.0.0.9017.zip(r-4.5-any)
cohortflow_0.0.0.9017.tgz(r-4.6-any)cohortflow_0.0.0.9017.tgz(r-4.5-any)
cohortflow_0.0.0.9017.tar.gz(r-4.7-any)cohortflow_0.0.0.9017.tar.gz(r-4.6-any)
cohortflow_0.0.0.9017.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
cohortflow/json (API)

# Install 'cohortflow' in R:
install.packages('cohortflow', repos = c('https://mattmoo.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/mattmoo/cohortflow/issues

Pkgdown/docs site:https://mattmoo.github.io

On CRAN:

Conda:

4.17 score 11 scripts 31 exports 26 dependencies

Last updated from:37ff11bc20. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK183
source / vignettesOK200
linux-releaseOK181
macos-releaseOK114
macos-oldrelOK182
windows-develOK134
windows-releaseOK105
windows-oldrelOK137
wasm-releaseOK105

Exports:apply_criteriaas_attrition_tableas_attrition_tibbleas_characteristics_tableas_characteristics_tibbleas_consort_diagramas_narrativecf_criteriacf_criterioncf_expectedcf_hierarchycheck_criteriacohortcontinue_criteriacriteria_statusexcludeexcludedexport_criteriagroup_excludegroup_includeimport_criteriaincludemock_cluster_rctmock_cohortflowmock_crossovermock_parallel_rctmock_stepped_wedgerandomisesave_consort_diagramselect_withinstack_cohorts

Dependencies:clicpp11dplyrfarvergenericsggplot2gluegtableisobandlabelinglifecyclemagrittrpillarpkgconfigR6RColorBrewerrlangS7scalestibbletidyselectutf8vctrsviridisLitewithryaml

Get started with cohortflow
Example data | 1. Define the criteria | 2. Apply them | 3. Get the cohort | 4. Attrition table | 5. CONSORT flow diagram | 6. Who was excluded? | 7. Writing it up | 8. Save the criteria | Next steps

Last update: 2026-11-23
Started: 2026-11-20

Hierarchical and cluster designs
Declaring the hierarchy | Counts at every level | How units are counted | Composite levels: stepped-wedge trials | Characteristics at the cluster level | Limits | See also

Last update: 2026-11-20
Started: 2026-11-20

Writing criteria
Step types at a glance | Writing conditions | Formulas | Functions | Labels and categories | Missing values | Grouped data | Whole groups: group_include() and group_exclude() | Rows within groups: select_within() | The randomisation point | Catching mistakes early | Building pipelines from pieces

Last update: 2026-11-20
Started: 2026-11-20

Readme and manuals

Help Manual

Help pageTopics
Apply a criteria pipeline to a data frameapply_criteria
Format an attrition table from a cohort flow objectas_attrition_table
Build an attrition tibble from a cohort flow objectas_attrition_tibble
Render a step-wise characteristics tableas_characteristics_table
Characteristics of the cohort at each stepas_characteristics_tibble
Build a CONSORT flow diagram from a cohort flow objectas_consort_diagram
Describe a cohort flow in words, for a methods sectionas_narrative print.cf_narrative
Create an eligibility criteria pipelinecf_criteria
Create a single cohort criterioncf_criterion
Declare the expected set of observational unitscf_expected
Declare the nesting hierarchy for a cohortcf_hierarchy
Check that criteria only refer to columns present in the datacheck_criteria
Extract the surviving cohort from a flow objectcohort
Continue a criteria pipeline on top of an existing flowcontinue_criteria
Per-criterion status of every rowcriteria_status
Add an exclusion criterion to a criteria pipelineexclude
Extract excluded rows from a flow objectexcluded
Export a criteria pipeline to YAMLexport_criteria
Add a group-level exclusion criteriongroup_exclude
Add a group-level inclusion criteriongroup_include
Import a criteria pipeline from YAMLimport_criteria
Add an inclusion criterion to a criteria pipelineinclude
Generate synthetic data for a cluster-randomised controlled trialmock_cluster_rct
Generate synthetic cohort data for testing and examples (deprecated)mock_cohortflow
Generate synthetic data for a crossover trialmock_crossover
Generate synthetic data for a parallel-group randomised controlled trialmock_parallel_rct
Generate synthetic data for a stepped-wedge cluster-randomised trialmock_stepped_wedge
Plot method for 'cf_flow' objectsplot.cf_flow
Print method for 'consort_diagram' objectsprint.consort_diagram
Mark the randomisation/allocation point in a criteria pipelinerandomise
Save a CONSORT diagram for manuscript submissionsave_consort_diagram
Select rows within groupsselect_within
Stack the cohort at each step into one data framestack_cohorts