[R] [solved] How to combine xtable and minipage with Sweave ?

Ptit_Bleu ptit_bleu at yahoo.fr
Mon Mar 16 17:18:38 CET 2009


Thanks to you all (and a bit to some websites dedicated to latex),
I finally managed to have a table and a graph side-by-side !!!

I'm not sure it will interested people, but here is the script working for
me 
(before the graph was below the table only because I have an empty line
between the 2 minipages !!! It's a bit tricky, isnt'it ?):

\begin{document}

\DefineVerbatimEnvironment{Sinput}{Verbatim}{formatcom = {\color[rgb]{0, 0,
0.56}}}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom = {\color[rgb]{0.56,
0, 0}}}
\setkeys{Gin}{width=\textwidth}

<<echo=FALSE, results=tex>>=
rg<-read.table(file="d:/RWork/rg.txt", sep=";", dec=".", header=T, as.is=T)
@

\begin{table}[h]
\begin{minipage}[h]{0.49\linewidth}
<<echo=FALSE, results=tex>>=
library(xtable)
print(xtable(rg), include.rownames=F, size="\\small", floating=FALSE)
@
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[h]{0.49\linewidth}
<<RsingleA,echo=F,fig=T,width=2.5,height=2.5>>=
plot(1:10)
@
\end{minipage}
\end{table}
\end{document} 


-- 
View this message in context: http://www.nabble.com/How-to-combine-xtable-and-minipage-with-Sweave---tp22493636p22541199.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list