consort_plot {consort}R Documentation

Self generating consort diagram


Create CONSORT diagram from a participant disposition data.


  allocation = NULL,
  labels = NULL,
  kickoff_sidebox = TRUE,
  cex = 0.8,
  text_width = NULL



Data set with disposition information for each participants.


A named vector or a list, names as the variable in the dataset and values as labels in the box. The order of the diagram will be based on this. A list can be used to report multiple variable in a single node, the first variable in a list element will be used to report the total and the exact items will be summarised for the remaining variable. This is limitted to non-side box.


Variable vector, appeared as side box in the diagram. The next box will be the subset of the missing values of these variables.


Name of the grouping/treatment variable (optional), the diagram will split into branches on this variables forward. For a factorial design, with two splits for example, a character vector with a maximum of length two can be provided. The extra box will be skipped if the values in the orders blank.


Named vector, names is the location of the terminal node. The position location should plus 1 after the allocation variables if the allocation is defined.


remove (default) the side box observations from the following counting.


Multiplier applied to font size, Default is 0.8


a positive integer giving the target column for wrapping lines in the output. String will not be wrapped if not defined (default). The stri_wrap function will be used if stringi package installed, otherwise strwrap will be used.


The calculation of numbers is as in an analogous to Kirchhoff's Laws of electricity. The numbers in terminal nodes must sum to those in the ancestor nodes. All the drop outs will be populated as a side box. Which was different from the official CONSORT diagram template, which has dropout inside a vertical node.


A consort object.

See Also

add_side_box,add_split, add_side_box textbox


## Prepare test data

df <-[!$arm3 %in% "Trt C", ]
p <- consort_plot(data = df,
                  orders = list(c(trialno = "Population"),
                                c(exclusion = "Excluded"),
                                c(arm     = "Randomized patient"),
                                c(arm3     = "", 
                                  subjid_notdosed="Participants not treated"),
                                c(followup    = "Pariticpants planned for follow-up",
                                  lost_followup = "Reason for tot followed"),
                                c(assessed = "Assessed for final outcome"),
                                c(no_value = "Reason for not assessed"),
                                c(mitt = "Included in the mITT analysis")),
                  side_box = c("exclusion", "no_value"),
                  allocation = c("arm", "arm3"),
                  labels = c("1" = "Screening", "2" = "Randomization",
                             "5" = "Follow-up", "7" = "Final analysis"),
                  cex = 0.7)

[Package consort version 1.2.2 Index]