remove_row_type: Remove rows by type

Description Usage Arguments Example Output Examples

View source: R/remove_row_type.R

Description

Removes either the header, reference, or missing rows from a gtsummary table.

Usage

1
2
3
4
5
remove_row_type(
  x,
  variables = everything(),
  type = c("header", "reference", "missing")
)

Arguments

x

gtsummary object

variables

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

type

type of row to remove. Must be one of c("header", "reference", "missing")

Example Output

Example 1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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")

ddsjoberg/gtsummary documentation built on April 8, 2021, 5:48 a.m.