Skip to content

Group labels for sets of variables in etable? #580

@abdullahshamim

Description

@abdullahshamim
data(mtcars)
model <- feols(mpg ~ hp + wt + cyl + gear, data = mtcars)

If I group hp and wt as "Engine" and cyl and gear as "Transmission" is there a way to get output like this?

\documentclass{article}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{caption}

\begin{document}

\begin{table}[htbp]
\centering
\begin{tabular}{l c}
\toprule
                & Model \\
\midrule
(Intercept)     & 36.69***  \\
                & (5.970)   \\
\addlinespace
\textbf{Engine} &           \\
\hspace{1em}hp  & -0.0178   \\
                & (0.0154)  \\
\hspace{1em}wt  & -3.916*** \\
                & (1.072)   \\
\addlinespace
\textbf{Transmission} &     \\
\hspace{1em}cyl & -0.5605   \\
                & (0.9751)  \\
\hspace{1em}gear & 0.7494   \\
                & (1.557)   \\
\bottomrule
\end{tabular}
\caption{Regression results with grouped covariates}
\end{table}

\end{document}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions