xtable left just

泄露秘密 提交于 2019-12-12 11:25:00

问题


the default of xtable is \begin{center}. I would like to make it: \begin{left} and \end{left} as well.

Code:

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

Desired outcome:

\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}

回答1:


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

So latex.environments = "left" is the solution.



来源:https://stackoverflow.com/questions/12470306/xtable-left-just

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!