[R] Some problems with Sweave

Andrew Robinson A.Robinson at ms.unimelb.edu.au
Fri May 23 12:18:00 CEST 2008


Martin,

try omitting the results=tex argument.

Andrew

On Fri, May 23, 2008 at 10:16:33AM +0200, martin.gaston at unavarra.es wrote:
> Dear R users,
> I'm working in a brief R-tutorial to a group of students. To make that I'm
> using Sweave but I've got two problems:
> 
> First, I want show how R operates with the matrix type but, I write in the
> .rnw document the code
> 
> <<echo=T,results=tex>>=
>  matriz <- matrix(vector,nrow=3,ncol=6)
>  matriz
> @
> 
> and after compilating the LaTex document I obtain in the pdf the next text
> 
> > matriz <- matrix(vector, nrow = 3, ncol = 6)
> > matriz
> [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 4 1 4 1 4 [2,] 2 5 2 5 2 5 [3,] 3 6 3
> 6 3 6
> 
> My question is, How must I do To obtain in the pdf somethin near to
> 
> > matriz <- matrix(vector, nrow = 3, ncol = 6)
> > matriz
>      [,1] [,2] [,3] [,4] [,5] [,6]
> [1,]    1    4    1    4    1    4
> [2,]    2    5    2    5    2    5
> [3,]    3    6    3    6    3    6
> 
> I`ve tought in xtable but the aspect is not as the R console.
> 
> On the other hand I want show the list type R-treatment, the problem here
> is in the LaTex compilation
> I write in the .rnwd document
> 
> <<echo=T,results=tex>>=
>  lista <- list(cadena='String',vector=c(1,1,1),logica=TRUE)
>  lista$cadena
> @
> 
> the Sweave call is ok, but when I compile the .tex document, It produces
> errors caused by the $ simbols. Anybody knows how save this problem?
> 
> Thanks in advance,
> Mart?n Gast?n
> 
> ______________________________________________
> R-help at 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.

-- 
Andrew Robinson  
Department of Mathematics and Statistics            Tel: +61-3-8344-6410
University of Melbourne, VIC 3010 Australia         Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/



More information about the R-help mailing list