Removes either the header, reference, or missing rows from a gtsummary table.
Usage
remove_row_type(
x,
variables = everything(),
type = c("header", "reference", "missing", "level", "all"),
level_value = NULL
)
Arguments
- x
(
gtsummary
)
A gtsummary object- variables
(
tidy-select
)
Variables to to remove rows from. Default iseverything()
- type
(
string
)
Type of row to remove. Must be one ofc("header", "reference", "missing", "level", "all")
- level_value
(
string
) Whentype='level'
you can specify the character value of the level to remove. WhenNULL
all levels are removed.
Examples
# Example 1 ----------------------------------
trial |>
dplyr::mutate(
age60 = ifelse(age < 60, "<60", "60+")
) |>
tbl_summary(by = trt, missing = "no", include = c(trt, age, age60)) |>
remove_row_type(age60, type = "header")
Characteristic
Drug A
N = 981
Drug B
N = 1021
1 Median (Q1, Q3); n (%)