does anyone know to rezize a table produzed by xtable? The size of my table is too big and I would like to resize it like using resizebox but it gives an erros when I try using it using it its fine \SweaveOpts{echo=false} <<results=tex>>xtable(stats0,caption='Número de transacções dos artigos frequentes e infrequentes',label='tab:INEStats') @ but the size is too big so I try <<echo=False,results=hide>>load('stats.Rdata') library(xtable) \resizebox{\textwidth}{!}{ \SweaveOpts{echo=false} <<results=tex>>xtable(stats0,caption='text',label='tab:Stats') @ } and it doesn t work anymore any hints? [[alternative HTML version deleted]]
Duncan, Thanks a lot! it sorted out the problem. I was too worried about learning how to use sweave that forgot to try other things :-) Teysseyre, I saw this doc but my table was large in width like almost not fitting the paper size.. Its better now but I wonder how to make better tables using xtable like for example how to use a similar thing to \multirow..does anyone maybe have had to do that before? Thanks! regards, Welma. 2009/8/7 Duncan Mackay <mackay@northnet.com.au>> Hi Welma > > Have you thought about working with latex commands rather than Sweave > 1 reduce the space between the columns the default is 7 > > \setlength\tabcolsep{3pt} > > 2 I frequently have wide tables so before the chunk > \begin{small} > <<>> > Sweave commands > @ > \end{small} > > Its very late here ... and so to bed > > Regards > > Duncan Mackay > Department of Agronomy and Soil Science > University of New England > ARMIDALE NSW 2351 > > At 21:03 7/08/2009, you wrote: > >> Content-Type: text/plain >> Content-Disposition: inline >> Content-length: 686 >> >> >> does anyone know to rezize a table produzed by xtable? The size of my >> table >> is too big and I would like to resize it like using resizebox but it gives >> an erros when I try using it >> >> >> using it its fine >> >> \SweaveOpts{echo=false} >> <<results=tex>>>> xtable(stats0,caption='Número de transacções dos artigos frequentes e >> infrequentes',label='tab:INEStats') >> @ >> >> but the size is too big >> >> so I try >> <<echo=False,results=hide>>>> load('stats.Rdata') >> library(xtable) >> >> \resizebox{\textwidth}{!}{ >> \SweaveOpts{echo=false} >> <<results=tex>>>> xtable(stats0,caption='text',label='tab:Stats') >> @ >> } >> >> and it doesn t work anymore >> >> any hints? >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> 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. >> > >[[alternative HTML version deleted]]
> Hi again, > > one last annoying thing: how to deal with %, always when I use sweave to get > a latex document the % comes as a comment and I cannot have % in my tables, > how to sort out this annoying detail? > > thanks! > Regards > WelmaHi Welma, You need to escape the % sign, just as you would if you were writing the table by hand. You can do this using gsub, e.g.: Data <- data.frame(X = paste(1:10,"%",sep=""),Y=paste(rnorm(10),"%",sep="")) Data$X <- gsub("%","\\\\%",Data$X) Data$Y <- gsub("%","\\\\%",Data$Y) library(xtable) print(xtable(Data)) % latex table generated in R 2.9.1 by xtable 1.5-5 package % Mon Aug 10 08:59:19 2009 \begin{table}[ht] \begin{center} \begin{tabular}{rll} \hline & X & Y \\ \hline 1 & 1$\backslash$\% & -0.745912124497115$\backslash$\% \\ 2 & 2$\backslash$\% & 0.230686751706215$\backslash$\% \\ 3 & 3$\backslash$\% & -0.111726300126857$\backslash$\% \\ 4 & 4$\backslash$\% & 1.47083079027849$\backslash$\% \\ 5 & 5$\backslash$\% & 0.594836094641913$\backslash$\% \\ 6 & 6$\backslash$\% & 0.317505326039211$\backslash$\% \\ 7 & 7$\backslash$\% & -0.545536941018959$\backslash$\% \\ 8 & 8$\backslash$\% & 0.894792412111052$\backslash$\% \\ 9 & 9$\backslash$\% & 0.616813341143258$\backslash$\% \\ 10 & 10$\backslash$\% & -0.469868401424871$\backslash$\% \\ \hline \end{tabular} \end{center} \end{table} Also, regarding your initial issue with the wide table: consider printing the table sideways instead of shrinking it. See the Sweave examples vignette for an example. -Ista