% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/easytab.R
\name{easytable}
\alias{easytable}
\title{Create Multi-Format Regression Tables}
\usage{
easytable(
  ...,
  model.names = NULL,
  output = "word",
  export.word = NULL,
  export.csv = NULL,
  robust.se = FALSE,
  control.var = NULL,
  margins = FALSE,
  highlight = FALSE,
  abbreviate = FALSE,
  table_size = "normalsize",
  digits = 2,
  custom.row = NULL
)
}
\arguments{
\item{...}{Statistical model objects (lm or glm). Pass models directly
like \code{easytable(m1, m2, m3)}.}

\item{model.names}{Character vector of custom names for model columns.
If NULL (default), columns are named "Model 1", "Model 2", etc.
Length must match number of models.}

\item{output}{Character string specifying output format. One of:
\itemize{
\item \code{"word"} - Microsoft Word via flextable (default)
\item \code{"latex"} - LaTeX for PDF output
}}

\item{export.word}{Character string ending in \code{.docx} for Word file export.
Only supported when \code{output = "word"}. If NULL (default), no file is written.}

\item{export.csv}{Character string ending in \code{.csv} for CSV export.
If NULL (default), no CSV file is written.}

\item{robust.se}{Logical. Use robust standard errors (HC type)? Default FALSE.
Requires packages: lmtest, sandwich}

\item{control.var}{Character vector of variable names to group as "control
variables". These will be collapsed into single rows showing "Y" for
presence instead of individual coefficients. Default NULL.}

\item{margins}{Logical. Compute average marginal effects (AME)? Default FALSE.
Requires package: margins}

\item{highlight}{Logical. Highlight significant coefficients (positive in green,
negative in red)? Default FALSE. Works best with Word output.}

\item{abbreviate}{Logical. Abbreviate variable names for readability? Default FALSE.
When TRUE, long variable names are shortened using deterministic rules.}

\item{table_size}{Character string specifying LaTeX table size. Only works with
\code{output = "latex"}. Options: "tiny", "small", "normalsize", "scriptsize".
Default "normalsize". Error if used with Word output.}

\item{digits}{Number of digits after the decimal point for coefficients and
standard errors, including the mantissa in scientific notation. Allowed
values are 0 to 4. Default 2.}

\item{custom.row}{Optional character vector for an additional row placed at
the bottom of the statistics block. The first element is the row label and
each subsequent element is the value for the corresponding model column.
The vector must have exactly one more element than the number of models.
Default NULL (no extra row).}
}
\value{
Depends on \code{output}:
\itemize{
\item \code{"word"} - A flextable object
\item \code{"latex"} - Character string with LaTeX table code
}
}
\description{
Takes model objects as arguments and creates formatted tables for
Word or LaTeX/PDF output. Supports robust standard errors,
marginal effects, and control variable grouping.
}
\details{
The function extracts coefficients, standard errors, and p-values from each
model, adds significance stars (*** p<.01, ** p<.05, * p<.1), and includes
model fit statistics such as N, R-squared, Adjusted R-squared, and
AIC (for \code{glm} models).

Control variables can be grouped to show presence/absence rather than
individual coefficients for each factor level or transformation.

Term labels are automatically formatted for readability:
\itemize{
\item Factor levels separated with colon (e.g., \code{advisor_confidence:low})
\item Interactions shown with a multiplication sign (e.g., \code{var1 × var2})
\item Polynomial contrasts as L indices (e.g., \code{var:L1}, \code{var:L2})
\item Long variable names abbreviated for clarity
}
}
\section{Dependencies}{

\itemize{
\item Always required: dplyr
\item Word output: flextable
\item LaTeX output: knitr, optionally kableExtra for enhanced formatting
\item Robust SE: lmtest, sandwich
\item Marginal effects: margins
}
}

