我正在使用stargazer
包生成数据集中变量的Latex摘要表。我不想在表格中显示百分位数统计信息(第25位和第75位),但是通过iqr = FALSE
禁用该选项无效。
我做错了还是这是一个错误?
已经感谢您的帮助!
这里是一个例子:
library(stargazer)
d.x <- data.frame(rnorm(1000))
stargazer(d.x, iqr = FALSE)
输出为:
% Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Wed, Nov 07, 2018 - 10:15:23
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lccccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean}
& \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Pctl(25)}
& \multicolumn{1}{c}{Pctl(75)} & \multicolumn{1}{c}{Max} \\
\hline \\[-1.8ex]
rnorm.1000. & 1,000 & 0.065 & 0.989 & $-$3.314 & $-$0.620 & 0.732 & 4.255 \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}
如您所见,Latex输出仍然包含百分位数统计信息:
\multicolumn{1}{c}{Pctl(25)}
& \multicolumn{1}{c}{Pctl(75)}
答案 0 :(得分:1)
啊,我自己解决了它:不用使用iqr = FALSE
选项,我可以通过向omit.summary.stat = c("p25", "p75")
的函数调用中添加stargazer
来省略百分位数。
完整代码是:
library(stargazer)
d.x <- data.frame(rnorm(1000))
stargazer(d.x, omit.summary.stat = c("p25", "p75"))
这会给出正确的乳胶输出,而没有百分位数:
% Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Wed, Nov 07, 2018 - 10:28:54
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Max} \\
\hline \\[-1.8ex]
rnorm.1000. & 1,000 & 0.065 & 0.989 & $-$3.314 & 4.255 \\
\hline \\[-1.8ex]
\end{tabular}
\end{table}