Я пытаюсь написать исследовательскую работу в rmarkdown
, в которой я пытаюсь создать таблицу summary stat
с использованием пакета stargazer
, но когда я включаю аргумент notes = c("All variables are defined in Appendix A.", "All continuous variables are winsorized at 1% and 99%.", "The pctl(25(75) corresponds to 25% (75%) percentile.")
, он показывает мне следующие ошибки in stargazer
-
! File ended while scanning use of \multicolumn.
<inserted text>
\par
<*> sample_articles.tex
Ниже приведена часть таблицы из моего tex
файла для указанной выше проблемы -
\begin{table}[!htbp] \centering
\caption{Summary Stat of Variables}
\label{}
\tiny
\begin{tabular}{@{\extracolsep{-5pt}}lcccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Pctl(25)} & \multicolumn{1}{c}{Median} & \multicolumn{1}{c}{Pctl(75)} \\
\hline \\[-1.8ex]
DEGREE & 19,114 & 67.7 & 15.7 & 56.3 & 68.7 & 79.7 \\
EIGENVECTOR & 19,114 & 61.6 & 20.1 & 48.7 & 64 & 77 \\
BETWEENNESS & 19,114 & 67.8 & 23.7 & 53.0 & 72.8 & 87.0 \\
CLOSENESS & 19,114 & 61.2 & 21.9 & 46.1 & 63 & 78 \\
OVERALLCENTRALITY & 19,114 & 67.4 & 21.6 & 51.8 & 71 & 85 \\
LNASSETS & 19,114 & 6.9 & 2.2 & 5.5 & 7.0 & 8.4 \\
LEVERAGE & 19,114 & 0.5 & 0.3 & 0.4 & 0.5 & 0.7 \\
INVREC & 19,114 & 0.2 & 0.2 & 0.1 & 0.2 & 0.3 \\
LOSS & 19,114 & 0.3 & 0.4 & 0 & 0 & 1 \\
ROA & 19,114 & 1.1 & 22.3 & $-$0.01 & 4.9 & 10.6 \\
ZSCORE & 19,114 & 0.9 & 0.9 & 0 & 1 & 2 \\
MERGER & 19,114 & 0.4 & 0.5 & 0 & 0 & 1 \\
MTB & 19,114 & 3.0 & 4.7 & 1.3 & 2.1 & 3.6 \\
FOREIGN & 19,114 & 0.5 & 0.5 & 0 & 0 & 1 \\
EXTRAORDINARY & 19,114 & 0.01 & 0.1 & 0 & 0 & 0 \\
SEGMENT & 19,114 & 2.1 & 0.8 & 1.4 & 2.0 & 2.6 \\
SPECIALIZED & 19,114 & 0.3 & 0.5 & 0 & 0 & 1 \\
MATERIALWEAKNESS & 19,114 & 0.05 & 0.2 & 0 & 0 & 0 \\
RESTATEMENT & 19,114 & 0.1 & 0.3 & 0 & 0 & 0 \\
BIGN & 19,114 & 0.8 & 0.4 & 1 & 1 & 1 \\
GOINGCONCERN & 19,114 & 0.02 & 0.1 & 0 & 0 & 0 \\
CALENDARYEAR & 19,114 & 0.8 & 0.4 & 1 & 1 & 1 \\
LNNONAUDFEES & 19,114 & 11.9 & 1.8 & 10.7 & 12.0 & 13.2 \\
LNAUDFEES & 19,114 & 14.0 & 1.3 & 13.2 & 14.0 & 14.8 \\
AUDTURNOVER & 19,114 & 0.1 & 0.2 & 0 & 0 & 0 \\
RESTRUCTURE & 19,114 & $-$0.002 & 0.1 & $-$0.001 & 0.0 & 0.0 \\
LITIGATE & 19,114 & 0.3 & 0.4 & 0 & 0 & 1 \\
AGE & 19,114 & 3.0 & 0.7 & 2.5 & 3.0 & 3.6 \\
AUDITORTENURE & 19,114 & 8.2 & 4.4 & 5 & 8 & 12 \\
AUDITLAG & 19,114 & 8.0 & 1.1 & 7.4 & 7.7 & 8.6 \\
AUDFEES (ml) & 19,114 & 2.7 & 5.7 & 0.5 & 1.2 & 2.7 \\
NAUDFEES (ml) & 19,114 & 0.7 & 2.1 & 0.05 & 0.2 & 0.5 \\
\hline \\[-1.8ex]
\multicolumn{7}{l}{All variables are defined in Appendix A.} \\
\multicolumn{7}{l}{All continuous variables are winsorized at level 1% and 99%.} \\
\multicolumn{7}{l}{The pctl(25 (75)) corresponds to 25% (75%) percentile.} \\
\end{tabular}
\end{table}
Однако, если я выберу приведенный выше аргумент notes
, работает нормально.
Ниже мой r code
в rmarkdown
без notes
аргумента в stargazer
-
sumstat_label <- c(
"DEGREE",
"EIGENVECTOR",
"BETWEENNESS",
"CLOSENESS",
"OVERALLCENTRALITY",
"LNASSETS",
"LEVERAGE",
"INVREC",
"LOSS",
"ROA",
"ZSCORE",
"MERGER",
"MTB",
"FOREIGN",
"EXTRAORDINARY",
"SEGMENT",
"SPECIALIZED",
"MATERIALWEAKNESS",
"RESTATEMENT",
"BIGN",
"GOINGCONCERN",
"CALENDARYEAR",
"LNNONAUDFEES",
"LNAUDFEES",
"AUDTURNOVER",
"RESTRUCTURE",
"LITIGATE",
"AGE",
"AUDITORTENURE",
"AUDITLAG",
"AUDFEES (ml)",
"NAUDFEES (ml)")
note_label <- c("All variables are defined in Appendix A.",
"All continuous variables are winsorized at 1% and 99%.",
"The pctl(25(75) corresponds to 25% (75%) percentile.")
stargazer(as.data.frame(sum_stat[c(
"DEGREE",
"EIGENVECTOR",
"BETWEENNESS",
"CLOSENESS",
"OVERALLCENTRALITY",
"LNASSETS",
"LEVERAGE",
"INVREC",
"LOSS",
"ROA",
"ZSCORE",
"MERGER",
"MTB",
"FOREIGN",
"EXTRAORDINARY",
"SEGMENT",
"SPECIALIZED",
"MATERIALWEAKNESS",
"RESTATEMENT",
"BIGN",
"GOINGCONCERN",
"CALENDARYEAR",
"LNNONAUDFEES",
"LNAUDFEES",
"AUDTURNOVER",
"RESTRUCTURE",
"LITIGATE",
"AGE",
"AUDITORTENURE",
"AUDITLAG",
"AUDFEES",
"NAUDFEES")]),
summary.stat = c("n", "mean", "sd", "p25", "median", "p75"),
column.sep.width = "-5pt",
title= "Summary Stat of Variables", type = "latex",
digits= 1,
header = FALSE,
notes.align = "l",
font.size = "small",
single.row = T,
no.space = T,
covariate.labels = sumstat_label
)
Есть ли у кого-нибудь идеи, как я могу добавить аргумент notes
в таблице с type = latex
в stargazer
. Спасибо.