xtable刚走(xtable left just)

2019-09-22 13:39发布

默认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}

Answer 1:

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

所以latex.environments = "left"是解决方案。



文章来源: xtable left just
标签: r xtable