Learn R Programming

hgutils (version 0.2.11)

inclusion_flowchart: 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).

Examples

Run this code
# 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
# }

Run the code above in your browser using DataLab