Skip to contents

Defining criteria

Build a criteria pipeline step by step. Row-wise steps (include(), exclude()) keep or drop individual rows; grouped steps act on whole groups such as clusters or participants; randomise() marks the allocation point.

cf_criteria()
Create an eligibility criteria pipeline
include()
Add an inclusion criterion to a criteria pipeline
exclude()
Add an exclusion criterion to a criteria pipeline
group_include()
Add a group-level inclusion criterion
group_exclude()
Add a group-level exclusion criterion
select_within()
Select rows within groups
randomise()
Mark the randomisation/allocation point in a criteria pipeline
cf_criterion()
Create a single cohort criterion
check_criteria()
Check that criteria only refer to columns present in the data

Applying criteria

Run a pipeline against data to get a cf_flow.

apply_criteria()
Apply a criteria pipeline to a data frame
continue_criteria()
Continue a criteria pipeline on top of an existing flow
cf_hierarchy()
Declare the nesting hierarchy for a cohort
cf_expected()
Declare the expected set of observational units

Inspecting a flow

Get the cohort, the excluded rows, and each row’s status at every step.

cohort()
Extract the surviving cohort from a flow object
excluded()
Extract excluded rows from a flow object
criteria_status()
Per-criterion status of every row
stack_cohorts()
Stack the cohort at each step into one data frame

Attrition tables

as_attrition_tibble()
Build an attrition tibble from a cohort flow object
as_attrition_table()
Format an attrition table from a cohort flow object

CONSORT diagrams

as_consort_diagram()
Build a CONSORT flow diagram from a cohort flow object
save_consort_diagram()
Save a CONSORT diagram for manuscript submission
plot(<cf_flow>)
Plot method for cf_flow objects
print(<consort_diagram>)
Print method for consort_diagram objects

Methods text

The same flow written as a paragraph for a methods section.

as_narrative() print(<cf_narrative>)
Describe a cohort flow in words, for a methods section

Baseline characteristics

Step-wise “Table 1” of the cohort, or of the rows removed, at each step.

as_characteristics_tibble()
Characteristics of the cohort at each step
as_characteristics_table()
Render a step-wise characteristics table

Reproducibility

export_criteria()
Export a criteria pipeline to YAML
import_criteria()
Import a criteria pipeline from YAML

Example data

Synthetic data for four common trial designs.

mock_parallel_rct()
Generate synthetic data for a parallel-group randomised controlled trial
mock_crossover()
Generate synthetic data for a crossover trial
mock_cluster_rct()
Generate synthetic data for a cluster-randomised controlled trial
mock_stepped_wedge()
Generate synthetic data for a stepped-wedge cluster-randomised trial

Deprecated

mock_cohortflow()
Generate synthetic cohort data for testing and examples (deprecated)