[R] Some problems with Sweave

From: <martin.gaston_at_unavarra.es>
Date: Fri, 23 May 2008 10:16:33 +0200 (CEST)


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. Received on Fri 23 May 2008 - 08:24:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 23 May 2008 - 11:30:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive