% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/descriptive_table.R
\name{descriptive_table}
\alias{descriptive_table}
\title{Descriptive Summary Table (no gtsummary) using gt/flextable}
\usage{
descriptive_table(
  data,
  exposures,
  by = NULL,
  percent = c("column", "row"),
  digits = 1,
  show_missing = c("ifany", "no"),
  show_dichotomous = c("all_levels", "single_row"),
  show_overall = c("no", "first", "last"),
  statistic = NULL,
  value = NULL,
  format = c("flextable", "gt"),
  theme = c("minimal")
)
}
\arguments{
\item{data}{data.frame}

\item{exposures}{Character vector of variables to summarise. Quoted names are
recommended in scripts, and bare names are also accepted.}

\item{by}{Optional single grouping variable. Quoted and bare names are
accepted.}

\item{percent}{"column" (default) or "row"; aliases like "col"/"rows" accepted}

\item{digits}{integer; decimals for \% and continuous stats (default 1)}

\item{show_missing}{"ifany" (default) or "no"}

\item{show_dichotomous}{"all_levels" (default) or "single_row"}

\item{show_overall}{"no" (default), "first", or "last"}

\item{statistic}{Optional summary type for numeric variables. Use a single
value such as \code{"mean"} or \code{mean} for all numeric variables, or a
named vector such as \code{c(age = mean, ftv = categorical)}. Supported
values are \code{"mean"}, \code{"median"}, \code{"mode"},
\code{"count"}, and \code{"categorical"}. Use \code{"categorical"} for
numeric ordinal variables that should be shown as n (\%).}

\item{value}{optional named list for single-row binaries (e.g., list(sex="Female"));
formula entries like list(sex ~ "Female") are also accepted}

\item{format}{"flextable" (default) or "gt"}

\item{theme}{preset or primitives}
}
\value{
A list with class \code{c("gtregression", "descriptive_table", ...)}
  containing:
  \describe{
    \item{\code{table}}{A \code{gt_tbl} or \code{flextable}.}
    \item{\code{table_display}}{Display-ready data.}
    \item{\code{table_body}}{Long audit data with variable, level, and type.}
    \item{\code{variable_labels}}{Named character vector of display labels
    used for variables.}
    \item{metadata}{Additional metadata fields.}
  }
}
\description{
Publication-ready summary of categorical and continuous variables
(optionally stratified). Mimics the OG gtsummary style:
* column headers include N, e.g. "Overall, N=200"
* categorical rows shown as n (\%)
* continuous rows default to Median (IQR) (footnote reflects summary)
}
\details{
If variables have a \code{"label"} attribute, for example from
\code{labelled::var_label()}, those labels are used automatically in the
displayed table. Internal matching still uses the original column names.
}
