Skip to contents

cifflowchart() creates a lightweight flowchart of exclusions, treatment groups, and outcome status with DiagrammeR. It can be used as a simple CONSORT-like flowchart helper, but it is not intended to fully automate a CONSORT-compliant diagram.

Usage

cifflowchart(
  formula,
  data,
  time.point = NULL,
  withdraw.consent = NULL,
  ineligible = NULL,
  pre.exclude = NULL,
  post.exclude = NULL,
  subset.condition = NULL,
  na.action = na.pass,
  outcome.type = NULL,
  code.event1 = 1,
  code.event2 = 2,
  code.censoring = 0,
  label.strata = NULL,
  order.strata = NULL,
  label.events = NULL,
  title = NULL,
  percent = TRUE,
  digits = 1,
  ...
)

Arguments

formula

A formula. Supported forms are response ~ arm, response ~ 1, and Event(time, status) ~ arm.

data

A data frame.

time.point

Optional time point for Event(time, status) formulas.

withdraw.consent, ineligible, pre.exclude, post.exclude

Optional exclusion variables. Logical vectors use TRUE as excluded. Character and factor vectors use non-missing, non-empty values as exclusion reasons.

subset.condition

Optional expression evaluated in data before counting.

na.action

Included for consistency with other formula interfaces. The default is na.pass because missing outcomes and missing groups are displayed in the flowchart.

outcome.type

Reserved for future use.

code.event1, code.event2, code.censoring

Status codes for event-history formulas.

label.strata

Optional labels for treatment groups.

order.strata

Optional order for treatment groups.

label.events

Optional labels for outcome states. A named vector may be used to map existing labels to display labels.

title

Optional graph title.

percent

Logical; show percentages in nodes.

digits

Number of digits for percentages.

...

Reserved for future use.

Value

A DiagrammeR::grViz() htmlwidget.

Lifecycle

[Experimental]

Examples

if (requireNamespace("DiagrammeR", quietly = TRUE)) {
  data(diabetes.complications)

  cifflowchart(
    Event(t, epsilon) ~ fruitq1,
    data = diabetes.complications,
    time.point = 8,
    outcome.type = "competing-risk"
  )
}