% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make_demographic_table_to_output.R
\name{make_demographic_table_to_output}
\alias{make_demographic_table_to_output}
\title{Create and Export Demographic Summary Table}
\usage{
make_demographic_table_to_output(
  data,
  vars,
  continuous_vars = NULL,
  file_name = "demographic_table",
  format = c("word", "excel", "csv"),
  path = NULL
)
}
\arguments{
\item{data}{A data frame containing the dataset.}

\item{vars}{Character vector of variable names to include in the
demographic summary.}

\item{continuous_vars}{Optional character vector specifying which
variables should be treated as continuous.
If `NULL`, numeric variables are automatically detected.}

\item{file_name}{Name of the output file WITHOUT extension
(e.g., "demographics").}

\item{format}{Output format. Must be one of:
\itemize{
  \item `"word"`  - exports to a Word document (.docx)
  \item `"excel"` - exports to an Excel file (.xlsx)
  \item `"csv"`   - exports to a CSV file (.csv)
}}

\item{path}{Optional character string specifying the directory where the
file should be saved. If `NULL` (default), the file is written to a
temporary directory. Provide a full directory path or use getwd()
during the function call.}
}
\value{
Invisibly returns the full file path to the generated output file.
}
\description{
Generates a demographic summary table using `make_demographic_table()`
and exports the resulting table to Word, Excel, or CSV format.

This is a convenience wrapper that combines analysis and output
in a single step for users who want immediate file export.
}
\details{
The demographic table includes:
\itemize{
  \item Categorical variables reported as n (%)
  \item Continuous variables reported as Mean (SD)
}

Word export uses `flextable` and `officer` for formatting.
Excel export uses `openxlsx`.
CSV export uses base R `write.csv()`.
}
