Hello, 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" "2009-03-10";"1";1958;147 "2009-03-10";"2";302;144 "2009-03-10";"3";4;141 "2009-03-10";"4";4;144 "2009-03-10";"5";217;145 "2009-03-10";"6";133;147 "2009-03-10";"7";431;144 "2009-03-10";"8";177;142 "2009-03-10";"9";146;143 "2009-03-10";"10";123;142 "2009-03-10";"11";308;143 "2009-03-10";"12";115;144 "2009-03-10";"13";146;142 "2009-03-10";"14";124;143 "2009-03-10";"15";176;142 "2009-03-10";"16";177;143 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) : ------------------------------------------------------------------------------------------------------ \documentclass[a4paper]{article} \usepackage[T1]{fontenc} \usepackage[frenchb]{babel} \usepackage{geometry} \usepackage{color, pdfcolmk} \usepackage[mediumqspace]{SIunits} \geometry{a4paper,left=1cm,right=1cm,top=1cm,bottom=1.5cm} \date{} \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{figure}[ht] \begin{minipage}[b]{0.5\linewidth} \centering <<RsingleA,echo=F,fig=T,width=2.5,height=2.5>>= plot(1:10) @ \caption{First figure} \label{fig:figure1} \end{minipage} \end{figure} \hspace{0.5cm} \begin{minipage}{0.7\textwidth} <<echo=FALSE, results=TEX>>= library(xtable) print(xtable(kw), include.rownames=F) @ \end{minipage} \end{document} ------------------------------------------------------------------------------------------------------ The following commands : Sweave("D:/RWork/test_minipage_sweave.rnw") 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. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.