remove_row_type: Remove rows by type

View source: R/remove_row_type.R

remove_row_typeR Documentation

Remove rows by type

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 object

variables

variables to to remove rows from. Default is everything()

type

type of row to remove. Must be one of

level_value

When type='level' you can specify the character value of the level to remove. When NULL all levels are removed. c("header", "reference", "missing")

Example Output

Example 1

image of rendered example table

See Also

Review list, formula, and selector syntax used throughout gtsummary

Examples

# Example 1 ----------------------------------
library(dplyr, warn.conflicts = FALSE, quietly = TRUE)
remove_row_type_ex1 <-
  trial %>%
  select(trt, age) %>%
  mutate(
    age60 = case_when(age < 60 ~ "<60", age >= 60 ~ "60+")
  ) %>%
  tbl_summary(by = trt, missing = "no") %>%
  remove_row_type(age60, type = "header")

gtsummary documentation built on Jan. 13, 2023, 9:10 a.m.