Skip to contents

Four ways in, checked in this order: steps (with con), raw counts (initial_n with exclusions), pooled sites, or cohort_data carrying attrition. The count and sites paths forward to summarize_attrition_consort().

Usage

generate_consort_attrition(
  con = NULL,
  cohort_data = NULL,
  cohort_id = 1L,
  steps = NULL,
  initial_n = NULL,
  exclusions = NULL,
  sites = NULL,
  min_cell = NULL
)

Arguments

con

Active DuckDB connection (optional if cohort_data carries attrition).

cohort_data

A data.frame with an "attrition" attribute, or an attrition table.

cohort_id

Evaluated cohort definition ID.

steps

Optional list of list(step_name, query) pairs.

initial_n, exclusions

Raw counts for one site: the source population and what each step removed.

sites

Named list of per-site attrition tables (or list(initial_n, exclusions)) to pool.

min_cell

Suppress counts from 1 to min_cell - 1 (default NULL: exact counts; pooled sites default to 11).

Value

An object of class consort_attrition with methods to_mermaid(), to_latex(), to_markdown().