I use xtable
to manage my tables in Sweave
like this
<<label=tab1, echo = FALSE, results = tex>>=
print(xtable(Table1))
@
<<label=tab2, echo = FALSE, results = tex>>=
print(xtable(Table2))
@
I wonder how to get these tables side by side. Any help will be highly appreciated. Thanks
Best Answer
The basic idea of this is that you need to make sure that the tables generated by
xtable
don't float; instead you should put them in your own floating environment. In the example below, I've generated two side-by-side tables, each within a{minipage}
environment and each with their own caption using the\captionof
command of thecaption
package.I've formatted the tables using
booktabs
. See How can I use a table generated by R in LaTeX? for more details on this.