add_box: Add nodes

Description Usage Arguments Value See Also Examples

View source: R/add_box.R

Description

Create/add vertically aligned labeled nodes or side nodes.

Usage

1
2
3
4
5
6
7
8
9
add_box(
  prev_box = NULL,
  txt,
  just = "center",
  dist = 0.02,
  y = unit(0.9, "npc"),
  text_width = NULL,
  ...
)

Arguments

prev_box

Previous node object, the created new node will be vertically aligned with this node. Left this as 'NULL' if this is the first node. The first node will be aligned in the top center.

txt

Text in the node. If the 'prev_box' is a horizontally aligned multiple nodes, a vector of with the same length must be provided.

just

The justification for the text: left, center or right.

dist

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

y

A number or unit object specifying y-location of the starting point of the diagram, default is 0.9npc. Will be ignored if prev_box is not null.

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,

Value

A consort object.

See Also

add_side_box,add_split

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
28
29
30
31
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"
  )
)

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