[R] Sweave doesn't work

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Mon Aug 22 13:14:59 CEST 2011


Hi Daniele,
"_" in "dati_england" is treated as a special character in LaTeX math
mode and causes your LaTeX-compiler trying to switch to math mode (you
might have noticed a warning abaout "missing `$' inserted"). To produce
a plain "_" in TeX you have to mask it as "\_". Package Hmisc has some
sanitization methods for that task, but you can do that easily by hand
using gsub.

Cheers.

Am 21.08.2011 18:18, schrieb danielepippo:
> Hi R users.
> 
> I've got a problem in producing the pdf file from Latex with R code. When I
> run the code Sweave("example.Rtex") in R it seems working, but when I run
> the Latex file it doesn't. The code error shown to me is below:
>  
> *Runaway argument?
> {echo=FALSE}
> data<- read.csv("C:\\Users\\Daniele\\Desktop\\dati\\dati_england
> ! File ended while scanning use of \FV at BeginScanning.
> <inserted text> 
>                 \par 
> <*> ...le/Desktop/dati/LaTeX1.Rtex*
> 
> The Sweave code in Latex is like this:
> 
> *\begin{Scode}{echo=FALSE}
> data<-
> read.csv("c:\\Users\\Daniele\\Desktop\\dati\\dati_england.csv",header=T,sep=",")
> \end{Scode}
> \begin{figure}[!h]
> \centering
> \begin{Scode}{fig=TRUE, width=6, height=9, echo=FALSE}
> data1=matrix(0,ncol=4,nrow=4)
> ....
> ....
> \end{Scode}
> \caption{Data}
> \end{figure}*
> 
> I don't know how to fix this problem. Any advices?
> Thanks very much
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Sweave-doesn-t-work-tp3758658p3758658.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.

-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790



More information about the R-help mailing list