Dear all, I use Sweave to create my reports. Unfortunately my script crashes whenever I my R code contains special characters like umlauts. Is there a way to to escape special characters in Sweave... This is the line that crashes Sweave: gl_bybranch = ddply(new_wans,.(period,Branchen), function(X) data.frame(Gesch?ftslage=mean(X$sentiment))) Unfortunately I can't just rename it, because I it?s displayed in the legend of graphics later on. Thx for any suggestions! best matt
On 22/07/2010 8:19 AM, Bunny, lautloscrew.com wrote:> Dear all, > > I use Sweave to create my reports. Unfortunately my script crashes whenever I my R code contains special characters like umlauts. > Is there a way to to escape special characters in Sweave... This is the line that crashes Sweave: > > gl_bybranch = ddply(new_wans,.(period,Branchen), function(X) data.frame(Gesch?ftslage=mean(X$sentiment))) > > Unfortunately I can't just rename it, because I it?s displayed in the legend of graphics later on. > > Thx for any suggestions! >I think you need to give us some more details. What does "my script crashes" mean? Does R fail, or does latex? What is the error message? The likely problem is something to do with character encodings. By default, latex usually only accepts plain ascii characters, nothing with accents -- but modern versions can handle other encodings if you declare them. So the solution may be as simple as declaring the encoding at the top of your .Rnw file, e.g. \usepackage[utf8]{inputenc} if you are using the UTF-8 encoding. Duncan Murdoch
A standalone example is always helpful. The following works for me, so I am probably not understanding your problem: ---[BEGIN: umlaut.Rnw]--- \documentclass[a4paper]{article} \usepackage{ucs} \usepackage[utf8x]{inputenc} \begin{document} <<test,echo=TRUE>>x <- data.frame(Gesch?ftslage=1:10) summary(x) @ \end{document} ---[END: umlaut.Rnw]--- $ R CMD Sweave umlaut.Rnw $ R CMD pdflatex umlaut.tex $ gnome-open umlaut.pdf Allan On 22/07/10 13:19, Bunny, lautloscrew.com wrote:> Dear all, > > I use Sweave to create my reports. Unfortunately my script crashes whenever I my R code contains special characters like umlauts. > Is there a way to to escape special characters in Sweave... This is the line that crashes Sweave: > > gl_bybranch = ddply(new_wans,.(period,Branchen), function(X) data.frame(Gesch?ftslage=mean(X$sentiment))) > > Unfortunately I can't just rename it, because I it?s displayed in the legend of graphics later on. > > Thx for any suggestions! > > best > > matt > > ______________________________________________ > 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. >