add_split: Add a splitting box

Description Usage Arguments Details Value See Also Examples

View source: R/add_split.R

Description

This function will create a horizontally aligned nodes. The horizontal coordinate will be automatically calculated if the coordinates not provided.

Usage

1
add_split(prev_box, txt, coords = NULL, dist = 0.02, text_width = NULL, ...)

Arguments

prev_box

Previous node that the newly created split box will be aligned.

txt

A vector of text labels for each nodes.

coords

The horizontal coordinates of the boxes, see details.

dist

Distance between previous node, including the distance between the side node.

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 stri_wrap function will be used if stringi package installed, otherwise strwrap will be used.

...

Other parameters pass to textbox,

Details

The 'coords' will be used to set the horizontal coordinates of the nodes. The 'coords' should be within 0 and 1 to avoid the nodes is aligned outside of the final figure. If the 'coords' is 'NULL', not given. The function will calculate the 'coords'. If the the length of the 'txt' is two, then a coordinates of 0.35 and 0.65 will be used. Once the split box is added, all the following nodes will be split accordingly.

Value

A consort.list object.

See Also

add_box, add_side_box

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
txt1 <- "Population (n=300)"
txt1_side <- "Excluded (n=15): \n
              \u2022 MRI not collected (n=3)\n
              \u2022 Tissues not collected (n=4)\n
              \u2022 Other (n=8)"

g <- add_box(txt = txt1)

g <- add_side_box(g, txt = txt1_side)

g <- add_box(g, txt = "Randomized (n=200)")

g <- add_split(g, txt = c("Arm A (n=100)", "Arm B (n=100"))
g <- add_side_box(g,
  txt = c(
    "Excluded (n=15):\n
                  \u2022 MRI not collected (n=3)\n
                  \u2022 Tissues not collected (n=4)\n
                   \u2022 Other (n=8)",
    "Excluded (n=15):\n
                   \u2022 MRI not collected (n=3)\n
                   \u2022 Tissues not collected (n=4)"
  )
)

g <- add_box(g, txt = c("Final analysis (n=100)", "Final analysis (n=100"))
g <- add_label_box(g, txt = c("1" = "Screening", "3" = "Randomized", "4" = "Final analysis"))

consort documentation built on Nov. 4, 2021, 5:06 p.m.