Tyler Rinker - 1 year ago 78

R Question

the default of

`xtable`

`\begin{center}`

`\begin{left}`

`\end{left}`

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}

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

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

So `latex.environments = "left"`

is the solution.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**