% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/modify_table.R
\name{modify_table}
\alias{modify_table}
\title{Modify Regression/Descriptive Tables (labels, headers, caption, notes)}
\usage{
modify_table(
  gt_table,
  variable_labels = NULL,
  level_labels = NULL,
  header_labels = NULL,
  caption = NULL,
  bold_labels = TRUE,
  bold_levels = FALSE,
  italic_labels = FALSE,
  italic_levels = FALSE,
  remove_N = FALSE,
  remove_N_obs = FALSE,
  remove_abbreviations = FALSE,
  remove_adjustment_note = FALSE,
  caveat = NULL
)
}
\arguments{
\item{gt_table}{Table object produced by this package (must contain
\code{$table_display}).}

\item{variable_labels}{Named character vector, for example
\code{c(old_var = "New label", ...)}.}

\item{level_labels}{Named list for factor levels:
\code{list(var1 = c(old = "New", ...), var2 = c(...))}.}

\item{header_labels}{Named character vector to rename visible headers, e.g.
\code{c("OR (95\% CI)" = "Crude OR", "p-value" = "P")}. Common aliases
such as \code{estimate}, \code{p.value}, and \code{N} are also accepted.}

\item{caption}{Optional caption/title.}

\item{bold_labels}{Logical; bold variable (header) rows in the body. Defaults
to \code{TRUE} to preserve the package table hierarchy.}

\item{bold_levels}{Logical; bold factor level rows in the body.}

\item{italic_labels}{Logical; italicize variable (header) rows in the body.}

\item{italic_levels}{Logical; italicize factor level rows in the body.}

\item{remove_N}{Logical; if \code{TRUE}, drops displayed \code{N} columns
from univariable and stratified package tables. For stratified survival
outputs, event columns are retained unless the original table was created
with \code{show_sample = "none"}.}

\item{remove_N_obs}{Logical; if \code{TRUE}, suppresses multivariable
complete-case footnote.}

\item{remove_abbreviations}{Logical; if \code{TRUE}, removes the
Abbreviations footnote line.}

\item{remove_adjustment_note}{Logical; if \code{TRUE}, removes the automatic
\code{Adjusted for ...} footnote. Use \code{caveat} to add customised
wording.}

\item{caveat}{Optional extra footnote.}
}
\value{
The modified table object (same class as input).
}
\description{
Works with objects created by this package (class \code{"gtregression"}):
\code{uni_reg()}, \code{multi_reg()}, \code{cox_reg()}, \code{surv_reg()},
stratified regression outputs, \code{descriptive_table()}, and
\code{merge_tables()}.
No \pkg{gtsummary} dependency or fallback.
}
\examples{
birthwt_data <- data_birthwt |>
  dplyr::mutate(
    smoke = factor(smoke, levels = c(0, 1), labels = c("No", "Yes")),
    ht = factor(ht, levels = c(0, 1), labels = c("No", "Yes")),
    low = factor(low, levels = c(0, 1), labels = c("Normal BW", "Low BW"))
  )

tbl <- uni_reg(
  data = birthwt_data,
  outcome = "low",
  exposures = c("age", "smoke", "ht"),
  approach = "logit",
  format = "gt"
)

modify_table(
  tbl,
  variable_labels = c(age = "Maternal age", smoke = "Smoking"),
  level_labels = list(smoke = c(Yes = "Smoker")),
  header_labels = c(estimate = "Crude OR", p.value = "P"),
  caption = "Univariable regression for low birth weight"
)$table
}
