inclusion_flowchart: Patient flowchart

View source: R/flowchart-utils.R

inclusion_flowchartR Documentation

Patient flowchart

Description

Creates a patient flowchart which visualizes exclusions and updates the dataset.

Usage

inclusion_flowchart(
  dataset,
  node_text = "%s eligable patients",
  stratum = NULL
)

exclude_patients(
  flowchart,
  dataset,
  exclusion_criterium,
  reason = deparse(substitute(exclusion_criterium)),
  node_text = "%s eligable patients",
  excluded_text = "%s excluded"
)

Arguments

dataset

The dataset, must be a data.frame.

node_text

The text of the starting node, must be a string which can be interpreted by sprintf.

stratum

An optional stratum, must be variable in dataset.

flowchart

The flowchart object.

exclusion_criterium

A boolean statement which is used to select patients to be discarded from the dataset.

reason

An optional string to specify why patients were excluded. Defaults to the exclusion criterium.

excluded_text

The text of the exclusion node, must be a string which can be interpreted by sprintf.

Value

A flowchart (when creating the flowchart), or updated dataset (when excluding patients).

Note

When excluding patients, the flowchart is updated 'behind the scenes' and is not returned.

Examples

## Not run: 
dataset = survival::lung; dataset$sex = factor(dataset$sex,labels=c("male","female"))
flowchart = inclusion_flowchart(dataset)
dataset = exclude_patients(flowchart, dataset, status==1) #exclude all patients who did not die
dataset = exclude_patients(flowchart, dataset, time<100) #exclude patients with a short follow-up
flowchart #print diagram

## End(Not run)

hgutils documentation built on March 31, 2022, 5:06 p.m.