I'm trying to use a stargazer LaTeX output for a basic OLS regression table in R, but the compilation keeps breaking down in the
\begin{tabular}{@{\extracolsep{5pt}}ld{.}{.}{-3}}
line due to an illegal character.
Here's the code:
\documentclass[12pt]{report}
\raggedright
\linespread{1.3}
\parskip=24pt
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[margin=1in]{geometry} % 1 inch margins all around
\usepackage[export]{adjustbox}
\usepackage{setspace}
\usepackage[utf8]{inputenc}
\begin{document}
Question 1\par
\includegraphics{unit2q1_scatterplot.png}
Question 2\par
\begin{table}[!htbp] \centering
\caption{OLS Regression Results}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}ld{.}{.}{-3}}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{1}{c}{\textit{Dependent variable:}} \\
\cline{2-2}
\\[-1.8ex] & \multicolumn{1}{c}{Gun Regulations} \\
\hline \\[-1.8ex]
State Population (Hund Thou) & 0.070^{**} \\
& (0.028) \\
Constant & 20.194^{***} \\
& (2.539) \\
\hline \\[-1.8ex]
Observations & \multicolumn{1}{c}{50} \\
R$^{2}$ & \multicolumn{1}{c}{0.116} \\
Adjusted R$^{2}$ & \multicolumn{1}{c}{0.098} \\
Residual Std. Error & \multicolumn{1}{c}{13.286 (df = 48)} \\
F Statistic & \multicolumn{1}{c}{6.298$^{**}$ (df = 1; 48)} \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
\end{document}
Can anyone tell me which character is illegal and why?
Best Answer
is not a defined column type. Perhaps you intended to use the
dcolumn
package (but that usesD
notd
)