Add a blank row below each variable group defined by variables or below each specified row_numbers. A blank row will not be added to the bottom of the table.

NOTE: For HTML flextable output (which includes the RStudio IDE Viewer), the blank rows do not render. But they will appear when the table is rendered to Word.

add_blank_rows(x, variables = NULL, row_numbers = NULL, variable_level = NULL)

Arguments

x

(gtsummary)
a 'gtsummary' table. The table must include a column named 'variable' in x$table_body.

variables, row_numbers, variable_level

(tidy-select or integer)

  • variables: When a table contains variable summaries, use this argument to add blank rows below the specified variable block.

  • row_numbers: Add blank rows after each row number specified.

  • variable_level: A single column name in x$table_body and blank rows will be added after each unique level.

Value

updated 'gtsummary' table.

Examples

# Example 1 ----------------------------------
# Default to every variable used
trial |>
  tbl_roche_summary(
    by = trt,
    include = c(age, marker, grade),
    nonmissing = "always"
  ) |>
  add_blank_rows(variables = everything())
Drug A
(N = 98)
Drug B
(N = 102)
Age

    n 91 98
    Mean (SD) 47 (15) 47 (14)
    Median 46 48
    Min - Max 6 - 78 9 - 83



Marker Level (ng/mL)

    n 92 98
    Mean (SD) 1.02 (0.89) 0.82 (0.83)
    Median 0.84 0.52
    Min - Max 0.00 - 3.87 0.01 - 3.64



Grade

    n 98 102
    I 35 (36%) 33 (32%)
    II 32 (33%) 36 (35%)
    III 31 (32%) 33 (32%)
# Example 2 ---------------------------------- trial |> tbl_roche_summary( by = trt, include = c(age, marker, grade), nonmissing = "always" ) |> add_blank_rows(variables = age)
Drug A
(N = 98)
Drug B
(N = 102)
Age

    n 91 98
    Mean (SD) 47 (15) 47 (14)
    Median 46 48
    Min - Max 6 - 78 9 - 83



Marker Level (ng/mL)

    n 92 98
    Mean (SD) 1.02 (0.89) 0.82 (0.83)
    Median 0.84 0.52
    Min - Max 0.00 - 3.87 0.01 - 3.64
Grade

    n 98 102
    I 35 (36%) 33 (32%)
    II 32 (33%) 36 (35%)
    III 31 (32%) 33 (32%)