I am generating a Latex summary table of the variables in my dataset using the stargazer package. I don't want percentile statistics (25th and 75th) in my table, but disabling the option via iqr = FALSE does not work.
Am I doing something wrong or is this a bug?
Thank you already for your help!
Here is an example:
library(stargazer)
d.x <- data.frame(rnorm(1000))
stargazer(d.x, iqr = FALSE)
The output is:
% 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}
As you see the Latex output still includes the percentile statistics:
\multicolumn{1}{c}{Pctl(25)}
& \multicolumn{1}{c}{Pctl(75)}
Ah, I solved it myself: Instead of using the iqr = FALSE option, I can ommit the percintiles by adding omit.summary.stat = c("p25", "p75") to the function call to stargazer.
The full code is:
library(stargazer)
d.x <- data.frame(rnorm(1000))
stargazer(d.x, omit.summary.stat = c("p25", "p75"))
This gives the correct Latex-output without the percentiles:
% 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}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With