[R] Some problems with Sweave

Charilaos Skiadas cskiadas at gmail.com
Fri May 23 12:13:27 CEST 2008


Try results=verbatim instead of results=tex.

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College


On May 23, 2008, at 4:16 AM, 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
>



More information about the R-help mailing list