我想得到一个格式如下的表:
我使用过“xtable”,但我不明白如何从print(table)命令中获取它:
> test
% latex table generated in R 3.2.3 by xtable 1.8-0 package
%
\begin{tabular}{lrrrrr}
\hline
& Df & Sum Sq & Mean Sq & F value & Pr($>$F) \\
\hline
Ws & 1 & 31680.42 & 31680.42 & 229.58 & 0.0000 \\
Pht & 2 & 11105.78 & 5552.89 & 40.24 & 0.0000 \\
Location & 12 & 58471.70 & 4872.64 & 35.31 & 0.0000 \\
Room & 1 & 5802.30 & 5802.30 & 42.05 & 0.0000 \\
Residuals & 8479 & 1170043.80 & 137.99 & & \\
\hline
\end{tabular}
dput(测试)
结构(列表(Df = c(1L,2L,12L,1L,8479L),Sum Sq
= c(31680.4185499081,
11105.7770715626,58471.7013752211,5802.30093225522,1170043.80160024
),Mean Sq
= c(31680.4185499081,5552.88853578132,4872.64178126843,
5802.30093225522,137.993136171747),F value
= c(229.579669169041,
40.240324191706,35.3107546972765,42.0477502955918,NA),Pr(>F)
= c(3.43375691459393e-51,
4.03894428387556e-18,4.68524863196024e-81,9.40518972974665e-11,
NA)),. Name = c(“Df”,“Sum Sq”,“Mean Sq”,“F value”,“Pr(> F)”
),row.names = c(“Ws”,“Pht”,“Location”,“Room”,“Residuals”
),class = c(“xtable”,“data.frame”),heading = c(“方差表分析\ n”,
“响应:离开”),align = c(“l”,“r”,“r”,“r”,“r”,“r”),digits = c(0,
0,2,2,2,4),display = c(“s”,“f”,“f”,“f”,“f”,“f”))