consort_plot | R Documentation |
Create CONSORT diagram from a participant disposition data.
consort_plot(
data,
orders,
side_box,
allocation = NULL,
labels = NULL,
kickoff_sidebox = TRUE,
cex = 0.8,
text_width = NULL
)
data |
Data set with disposition information for each participants. |
orders |
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. |
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. |
allocation |
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 |
labels |
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. |
kickoff_sidebox |
remove (default) the side box observations from the following counting. |
cex |
Multiplier applied to font size, Default is 0.8 |
text_width |
a positive integer giving the target column for wrapping
lines in the output. String will not be wrapped if not defined (default).
The |
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.
add_side_box
,add_split
,
add_side_box
textbox
## Prepare test data
data(dispos.data)
df <- dispos.data[!dispos.data$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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.