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

Ptit_Bleu ptit_bleu at yahoo.fr
Fri Mar 13 11:20:19 CET 2009


I'm trying to put a dynamic table and a dynamic graph side by side in a pdf
document using Sweave.
The data.frame used to generate the table is called rg (rg.txt):

"Date"; "Code"; "Data1"; "Data2"

The Sweave script to test, saved as test_minipage_sweave.rnw, is the
following one (I'm a newbie in Latex and R so I pasted some commands I found
here and there) :

\usepackage{color, pdfcolmk}



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

<<echo=FALSE, results=TEX>>=

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

\caption{First figure}



  <<echo=FALSE, results=TEX>>=
  print(xtable(kw), include.rownames=F)



The following commands :
     shell("pdflatex D:/RWork/test_minipage_sweave.tex")
give me a .pdf file containing the graph but instead of the table I have
this text, below the graph :
echo=FALSE, results=TEX = library(xtable) print(xtable(kw),
include.rownames=F) @

It means that it doesn't recognize a R command but I don't kno why. And it
is a problem with minipage because I managed to create a pdf file with only
the table.

Could someone give me a solution or at least a working example which I can
modify ?
Thanks in advance,
Have a nice week-end,
Ptit Bleu.
View this message in context: http://www.nabble.com/How-to-combine-xtable-and-minipage-with-Sweave---tp22493636p22493636.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list