每当我尝试制作 PDF 文档时,就会出现此问题。我该如何处理?这个问题让我很尴尬!
\begin{table}[!htbp] \centering
\caption{Comparison of Regression Results}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{3}{c}{\textit{Dependent variable:}} \\
\cline{2-4}
\\[-1.8ex] & \multicolumn{3}{c}{Corruption} \\
\\[-1.8ex] & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)}\\
\hline \\[-1.8ex]
GDP per capita & 0.0002^{***}$ $(0.0002$, $0.0002) & & \\
GDP per capita (Squred) & & 0.000^{***}$ $(0.000$, $0.000) & \\
GDP per capital (Log) & & & 1.431^{***}$ $(1.255$, $1.606) \\
Constant & 2.502^{***}$ $(2.259$, $2.746) & 3.413^{***}$ $(3.154$, $3.671) & -8.114^{***}$ $(-9.621$, $-6.607) \\
\hline \\[-1.8ex]
Observations & \multicolumn{1}{c}{170} & \multicolumn{1}{c}{170} & \multicolumn{1}{c}{170} \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{3}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
ADD 语法
library(stargazer)
stargazer(q4_fit, q4_fit_squred, q4_g_log, type="latex",
title ="Comparison of Regression Results", align=TRUE,
dep.var.labels="Corruption",
covariate.labels=c("GDP per capita", "GDP per capita (Squred)", "GDP per capital (Log)"),
keep.stat="n", ci=TRUE, ci.level=0.95, single.row=TRUE)
答案1
错误消息是由于您使用了但未定义的数组列说明符D
(我猜是因为您既没有显示完整的错误也没有显示测试文档)
您正在使用包的语法dcolumn
,只需加载该包就可以消除错误,尽管-3
此处的规范使表格非常宽,不太可能适合您的(未指定的)页面大小。
我猜你想要类似的东西
\documentclass{article}
\usepackage{dcolumn,rotating}
\begin{document}
\begin{sidewaystable} \centering
\caption{Comparison of Regression Results}
\label{}
\begin{tabular}{lD{.}{.}{1.7}l D{.}{.}{1.7}l D{.}{.}{1.7}l }
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{6}{c}{\textit{Dependent variable:}} \\
\cline{2-7}
\\[-1.8ex] & \multicolumn{6}{c}{Corruption} \\
\\[-1.8ex] & \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{1}{c}{(3)}\\
\hline \\[-1.8ex]
GDP per capita & 0.0002^{***}& (0.0002, 0.0002) & & && \\
GDP per capita (Squared) & & & 0.000^{***}&(0.000, 0.000) && \\
GDP per capital (Log) & & & & & 1.431^{***}&(1.255, 1.606) \\
Constant & 2.502^{***}&(2.259, 2.746) & 3.413^{***}&(3.154, 3.671) & -8.114^{***}&(-9.621, -6.607) \\
\hline \\[-1.8ex]
Observations & \multicolumn{2}{c}{170} & \multicolumn{2}{c}{170} & \multicolumn{2}{c}{170} \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{4}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{sidewaystable}
\end{document}