remove_row_type: Remove rows

View source: R/remove_row_type.R

remove_row_typeR Documentation

Remove rows

Description

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

type

(string)
Type of row to remove. Must be one of c("header", "reference", "missing", "level", "all")

level_value

(string) When type='level' you can specify the character value of the level to remove. When NULL all levels are removed.

Value

Modified gtsummary table

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

gtsummary documentation built on Oct. 5, 2024, 1:06 a.m.