Skip to contents

Hide or unhide columns of a table. Run show_header_names(x, show_hidden = TRUE) to list the columns, including the hidden ones, that can be shown.

Usage

modify_column_hide(x, columns)

modify_column_unhide(x, columns)

Arguments

x

(ltsummary)
An ltsummary object.

columns

(selector)
Columns of x$table_body.

Value

An ltsummary object.

Examples

tbl <- trial |>
  tbl_summary(by = trt, include = c(age, grade), missing = "no") |>
  add_p()

# Example 1 ----------------------------------
# show the test statistic that add_p() stored, and hide the second arm
tbl |>
  modify_column_unhide(columns = statistic) |>
  modify_fmt_fun(statistic = label_style_sigfig(digits = 3)) |>
  modify_header(statistic = "**Statistic**") |>
  modify_column_hide(columns = stat_2)