add_blank_rows: Add Blank Row

View source: R/add_blank_rows.R

add_blank_rowsR Documentation

Add Blank Row

Description

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.

Usage

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())

# Example 2 ----------------------------------
trial |>
  tbl_roche_summary(
    by = trt,
    include = c(age, marker, grade),
    nonmissing = "always"
  ) |>
  add_blank_rows(variables = age)

crane documentation built on Aug. 30, 2025, 1:12 a.m.