I am just beginning to use Sweave with Lyx on a Mac (R2.8.1). I have 12 chunks of Sweave code that work fine, but this piece:
<<>>= library(car) cabbages$Year<-recode(cabbages$Year,"'X2001'='2001';'X2002'='2002';'X2003'='2003';'X2004'='2004';'X2005'='2005';'X2006'='2006';'X2007'='2007';'X2008'='2008';'X2009'='2009';'X2010'='2010';'X2011'='2011';'X2012'='2012'") @ just prints out verbatim as a single line running off the page (No recoding occurs). It worked in R before pasting into Lyx. Initially I had the double quotes and single quotes the other way round, but this produced this in the complied pdf: > cabbages$Year <- recode(cabbages$Year, > "\"X2001\"=\"2001\";\"X2002\"=\"2002\";\"X2003\"=\"2003\";\ etc The first double quote in the printout shown above was a single quote before compiling. I have asked on the Lyx forum for help, but maybe someone here can suggest what I might be doing wrong. Of course it could be a Mac/Lyx issue rather than an SWeave/R issue, but any help would be appreciated. Thanks, Graham ______________________________________________ R-help@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.