I am trying to make a table span many pages. Here is my code:
\begin{table}[!htbp] \centering
\caption{Results for Living Standard Indicators}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{3}{c}{\textit{Dependent variable:}} \\
\cline{2-4}
\\[-1.8ex] & $K_{i,t}$ & $H_{i,t}$ & $I_{i,t}$ \\
& Physical Capital & Human Capital & Institutional Capital \\
\\[-1.8ex] & (1) & (2) & (3)\\
\hline \\[-1.8ex]
$R_{i}$ & $-$0.10$^{***}$ & $-$0.05 & 0.08 \\
& (0.02) & (0.04) & (0.08) \\
& & & \\
$R_{i}$*$Y_{i,t}$^{2}$ & $-$0.002 & $-$0.01$^{**}$ & $-$0.01 \\
& (0.002) & (0.004) & (0.01) \\
& & & \\
$R_{i}$*$Y_{i,t}$ & 0.13$^{*}$ & 0.69$^{***}$ & 0.22 \\
& (0.07) & (0.18) & (0.42) \\
& & & \\
$R_{i}$*$NR_{i}$ & $-$0.50$^{***}$ & 0.18 & $-$0.98$^{*}$ \\
& (0.09) & (0.23) & (0.56) \\
& & & \\
$R_{i}$*$D_{i}$ & 0.01 & 0.05 & 0.11 \\
& (0.02) & (0.04) & (0.08) \\
& & & \\
$R_{i}$*$L_{i}$ & 0.0004 & $-$0.05 & $-$0.23$^{***}$ \\
& (0.01) & (0.03) & (0.06) \\
& & & \\
$R_{i}$*$V_{i}$ & 0.02$^{**}$ & $-$0.06$^{*}$ & $-$0.12$^{***}$ \\
& (0.01) & (0.03) & (0.04) \\
& & & \\
$R_{i}$*$C_{i}$ & 0.03$^{**}$ & $-$0.08$^{**}$ & $-$0.17$^{**}$ \\
& (0.01) & (0.04) & (0.07) \\
& & & \\
$R_{i}$*$M_{i}$ & $-$0.01 & $-$0.04$^{**}$ & 0.09$^{***}$ \\
& (0.01) & (0.02) & (0.03) \\
& & & \\
$R_{i}$*$S_{i}$ & 0.04$^{***}$ & 0.23$^{***}$ & 0.19$^{**}$ \\
& (0.02) & (0.04) & (0.08) \\
& & & \\
$R_{i}$*$Dem_{i}$ & 0.05$^{***}$ & 0.07$^{***}$ & 0.07 \\
& (0.02) & (0.02) & (0.05) \\
& & & \\
$R_{i}$*$Right_{i}$ & $-$0.02 & $-$0.03 & $-$0.20$^{*}$ \\
& (0.02) & (0.05) & (0.10) \\
& & & \\
$R_{i}$*$Left_{i} & 0.02 & $-$0.03 & $-$0.08 \\
& (0.01) & (0.05) & (0.07) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$L_{i}$ & $-$0.01 & $-$0.37$^{*}$ & $-$0.52 \\
& (0.07) & (0.19) & (0.37) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$V_{i}$ & 0.001 & 0.51$^{***}$ & 0.18 \\
& (0.05) & (0.12) & (0.22) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$C_{i}$ & $-$0.08 & $-$0.33$^{**}$ & $-$0.80$^{**}$ \\
& (0.06) & (0.16) & (0.36) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$M_{i}$ & $-$0.01 & $-$0.17$^{**}$ & 0.14 \\
& (0.03) & (0.08) & (0.16) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$S_{i}$ & $-$0.01 & $-$0.86$^{***}$ & 0.87$^{**}$ \\
& (0.08) & (0.20) & (0.42) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$Dem_{i} & 0.10$^{*}$ & $-$0.14 & 0.07 \\
& (0.05) & (0.09) & (0.27) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$Left_{i}$ & 0.02 & $-$0.67$^{***}$ & 0.31 \\
& (0.05) & (0.20) & (0.29) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$Right_{i}$ & 0.15$^{*}$ & 0.39 & 0.11 \\
& (0.08) & (0.24) & (0.53) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$D_{i}$ & $-$0.29$^{***}$ & $-$0.35$^{**}$ & 0.59$^{*}$ \\
& (0.07) & (0.16) & (0.32) \\
& & & \\
$R_{i}$*$Y_{i,t}$*$NR_{i}$ & 0.56 & 0.83 & 1.05 \\
& (0.39) & (1.15) & (2.35) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$L_{i}$ & $-$0.002 & 0.003 & $-$0.02$^{*}$ \\
& (0.002) & (0.005) & (0.01) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$V_{i}$ & $-$0.0001 & $-$0.004$^{*}$ & 0.004 \\
& (0.001) & (0.002) & (0.004) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$C_{i}$ & 0.003$^{**}$ & 0.01$^{*}$ & 0.01$^{*}$ \\
& (0.001) & (0.003) & (0.01) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$M_{i}$ & $-$0.001 & 0.003$^{*}$ & $-$0.001 \\
& (0.001) & (0.002) & (0.004) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$S_{i}$ & $-$0.0005 & 0.01$^{***}$ & $-$0.01$^{**}$ \\
& (0.002) & (0.003) & (0.01) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$Dem_{i}$ & $-$0.001 & 0.001 & 0.01 \\
& (0.001) & (0.002) & (0.01) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$D_{i}$ & 0.001 & 0.01 & $-$0.01 \\
& (0.002) & (0.004) & (0.01) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$NR_{i}$ & $-$0.01 & $-$0.004 & 0.02 \\
& (0.01) & (0.04) & (0.08) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$Left_{i}$ & 0.004$^{**}$ & 0.01$^{**}$ & 0.02$^{***}$ \\
& (0.001) & (0.005) & (0.01) \\
& & & \\
$R_{i}$*$Y_{i,t}^{2}$*$Right_{i}$ & $-$0.0003 & $-$0.003 & 0.01 \\
& (0.001) & (0.003) & (0.01) \\
& & & \\
Constant & 0.05$^{***}$ & 0.22$^{***}$ & 0.42$^{***}$ \\
& (0.01) & (0.03) & (0.05) \\
& & & \\
\hline \\[-1.8ex]
F Statistic & 20.67*** & 84.70*** & 39.09*** \\
Observations & 1,053 & 1,053 & 1,053 \\
R$^{2}$ & 0.28 & 0.56 & 0.44 \\
Adjusted R$^{2}$ & 0.25 & 0.54 & 0.42 \\
Residual Std. Error (df = 1002) & 0.08 & 0.16 & 0.26 \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{3}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
I have tried to incorporate longtable
, but it does not work for me. The table was created using the stargazer
package in R-Studio, and then imported into Overleaf. Has anyone run into a similar problem? Is this a stargazer limitation and if so how would I overcome this?
Thanks in advance!
Best Answer
Here's an adaptation of your code that employs a
longtable
environment. Observe that I had to fix a number of issues with your code in addition to changing over from atable
/tabular
combination to alongtable
. Among them are a replacement of all instances of$*$
with\times
and a replacement of all instances of& & & \\
with\addlinespace
, a macro provided by thebooktabs
package.The following screenshot shows just the first few rows of the resulting table.