gpt4 book ai didi

r - 如何在观星者输出中省略开始表

转载 作者:行者123 更新时间:2023-12-04 02:59:42 26 4
gpt4 key购买 nike

library(stargazer)

stargazer(mtcars)

我想省略表格设置部分,而不是:

% Table created by StarGazer v.3.0.1 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Thu, May 09, 2013 - 16:14:28

\begin{table}[htb] \centering
\caption{}
\label{}
\footnotesize

\begin{tabular}{@{\extracolsep{5pt}}l c c c c c }
\\[-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]
mpg & 32 & 20.091 & 6.027 & 10.400 & 33.900 \\
cyl & 32 & 6.188 & 1.786 & 4 & 8 \\
disp & 32 & 230.722 & 123.939 & 71.100 & 472.000 \\
hp & 32 & 146.688 & 68.563 & 52 & 335 \\
drat & 32 & 3.597 & 0.535 & 2.760 & 4.930 \\
wt & 32 & 3.217 & 0.978 & 1.513 & 5.424 \\
qsec & 32 & 17.849 & 1.787 & 14.500 & 22.900 \\
vs & 32 & 0.438 & 0.504 & 0 & 1 \\
am & 32 & 0.406 & 0.499 & 0 & 1 \\
gear & 32 & 3.688 & 0.738 & 3 & 5 \\
carb & 32 & 2.812 & 1.615 & 1 & 8 \\
\hline \\[-1.8ex]
\normalsize
\end{tabular}
\end{table}

我得到的是:

% Table created by StarGazer v.3.0.1 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Thu, May 09, 2013 - 16:14:28

\begin{tabular}{@{\extracolsep{5pt}}l c c c c c }
\\[-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]
mpg & 32 & 20.091 & 6.027 & 10.400 & 33.900 \\
cyl & 32 & 6.188 & 1.786 & 4 & 8 \\
disp & 32 & 230.722 & 123.939 & 71.100 & 472.000 \\
hp & 32 & 146.688 & 68.563 & 52 & 335 \\
drat & 32 & 3.597 & 0.535 & 2.760 & 4.930 \\
wt & 32 & 3.217 & 0.978 & 1.513 & 5.424 \\
qsec & 32 & 17.849 & 1.787 & 14.500 & 22.900 \\
vs & 32 & 0.438 & 0.504 & 0 & 1 \\
am & 32 & 0.406 & 0.499 & 0 & 1 \\
gear & 32 & 3.688 & 0.738 & 3 & 5 \\
carb & 32 & 2.812 & 1.615 & 1 & 8 \\
\hline \\[-1.8ex]
\normalsize
\end{tabular}

最佳答案

来自 help("stargazer"):

   float: a logical value that indicates whether the resulting table
will be a floating table (set off, for instance, by
‘\begin{table}’ and ‘\end{table}’).

所以,

> stargazer(mtcars, float = FALSE)

% Table created by stargazer v.5.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Fri, May 11, 2018 - 06:43:39 PM
\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]
mpg & 32 & 20.091 & 6.027 & 10.400 & 33.900 \\
cyl & 32 & 6.188 & 1.786 & 4 & 8 \\
disp & 32 & 230.722 & 123.939 & 71.100 & 472.000 \\
hp & 32 & 146.688 & 68.563 & 52 & 335 \\
drat & 32 & 3.597 & 0.535 & 2.760 & 4.930 \\
wt & 32 & 3.217 & 0.978 & 1.513 & 5.424 \\
qsec & 32 & 17.849 & 1.787 & 14.500 & 22.900 \\
vs & 32 & 0.438 & 0.504 & 0 & 1 \\
am & 32 & 0.406 & 0.499 & 0 & 1 \\
gear & 32 & 3.688 & 0.738 & 3 & 5 \\
carb & 32 & 2.812 & 1.615 & 1 & 8 \\
\hline \\[-1.8ex]
\end{tabular}

关于r - 如何在观星者输出中省略开始表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50301396/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com