gtsummary (version 1.3.6)

modify_table_header: Modify table_header

Description

This is a function meant for advanced users to gain more control over the characteristics of the resulting gtsummary table.

Usage

modify_table_header(
  x,
  column,
  label = NULL,
  hide = NULL,
  align = NULL,
  missing_emdash = NULL,
  indent = NULL,
  text_interpret = NULL,
  bold = NULL,
  italic = NULL,
  fmt_fun = NULL,
  footnote_abbrev = NULL,
  footnote = NULL,
  spanning_header = NULL
)

Arguments

x

gtsummary object

column

vector or selector of columns in x$table_body

label

string of column label

hide

logical indicating whether to hide column from output

align

string indicating alignment of column, must be one of c("left", "right", "center")

missing_emdash

string that evaluates to logical identifying rows to include em-dash for missing values, e.g. "reference_row == TRUE"

indent

string that evaluates to logical identifying rows to indent

text_interpret

string, must be one of "gt::md" or "gt::html"

bold

string that evaluates to logical identifying rows to bold

italic

string that evaluates to logical identifying rows to italicize

fmt_fun

function that formats the statistics in the column

footnote_abbrev

string with abbreviation definition, e.g. "CI = Confidence Interval"

footnote

string with text for column footnote

spanning_header

string with text for spanning header

Example Output

Example 1

Details

Review the gtsummary definition vignette for information on .$table_header objects.

See Also

modify_table_body()

See gtsummary internals vignette

Examples

Run this code
# NOT RUN {
# Example 1 ----------------------------------
modify_table_header_ex1 <-
  lm(mpg ~ factor(cyl), mtcars) %>%
  tbl_regression() %>%
  modify_table_header(column = estimate,
                      label = "**Coefficient**",
                      fmt_fun = function(x) style_sigfig(x, digits = 5),
                      footnote = "Regression Coefficient") %>%
  modify_table_header(column = "p.value",
                      hide = TRUE)
# }

Run the code above in your browser using DataCamp Workspace