4

默认xtable值为\begin{center}. 我想做到:\begin{left}而且\end{left}也是。

代码:

library(xtable)
xtable(anova(lm(mpg~hp, data=mtcars)))

期望的结果:

\begin{table}[ht]
\begin{left}
\begin{tabular}{lrrrrr}
  \hline
 & Df & Sum Sq & Mean Sq & F value & Pr($>$F) \\ 
  \hline
hp & 1 & 678.37 & 678.37 & 45.46 & 0.0000 \\ 
  Residuals & 30 & 447.67 & 14.92 &  &  \\ 
   \hline
\end{tabular}
\end{left}
\end{table}
4

1 回答 1

3
print(xtable(anova(lm(mpg~hp, data=mtcars))) , booktabs=TRUE, caption.placement = "top",
    latex.environments = "left")

解决方案也是如此latex.environments = "left"

于 2012-09-18T04:25:51.417 回答