John, Thanks, its difficult when you don't know where the problem is. The code works fine directly in R on the Mac, and from whta you say it works with Sweave, so it seems to narrow it down to Lyx/Sweave/Mac interaction.
Graham 2009/6/12 John Fox <j...@mcmaster.ca>: > Dear Graham, > > I just tried a similar recode() command using Sweave on a Windows system > (not through LyX) and it worked fine. > > I hope this helps, > John > >> -----Original Message----- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On >> Behalf Of Graham Smith >> Sent: June-12-09 10:27 AM >> To: r-help@r-project.org >> Subject: [R] Sweave recode(car) and Lyx, compiling but not executing on > Mac >> >> 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'=' > 2 >> > 004';'X2005'='2005';'X2006'='2006';'X2007'='2007';'X2008'='2008';'X2009'='20 > 0 >> 9';'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. > > > ______________________________________________ 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.