Skip to contents

Draws one box per attrition step (N and percent retained) and an "Excluded" box for every step with drops, straight from the attrition table, so the figure cannot drift from the SQL counts. Uses base graphics only. The format follows the file extension (png, svg, pdf, jpeg). Mirror of Python omop_etl.cohort.export_consort_flowchart.

Usage

export_consort_flowchart(
  attrition,
  out_path = "figure1.png",
  title = NULL,
  dpi = 300,
  terminal_split = NULL
)

Arguments

attrition

A consort_attrition object, the compute_attrition() data.frame, or a cohort carrying an attrition attribute.

out_path

Output file (default "figure1.png").

title

Optional title.

dpi

Resolution for raster formats.

terminal_split

Optional named numeric (label = N) drawn as a row of branching outcome boxes under the last step, each with its percentage of the split total.

Value

out_path, invisibly.

Details

An exclusion_reason column in the attrition table is shown in the exclusion boxes.