Well this is a bit embarrassing , it seems I had two problems, one
was that the recode command seems to need utf8 coding rather than the
Lyx default (which is fine), plus I had typing error in the data set,
which is not fine :-(

I rewrote my code using the "with" command which allowed it to run, but
it then became obvious that the recoded results were not what I had
expected. The typing error then being obvious.

The first entry in my code was 'X2001'='2001' but the first level in
the data set was "X20001" and this was enough to cause recode to fail
in my original code, but run using the with command.

Its now working. BUT the code still runs off the edge of the page and doesn't wrap with a continuation symbol. Anyone have any suggestions for fixing this one?

Thanks to everyone for there help.

Graham Smith wrote:
I've started using Sweave and having a problem

The code in Lyx is

library (car)

cabbages$Year<-recode(cabbages$Year,'"X2001"="2001";"X2002"="2002";"X2003"="2003"; etc

But its appearing in the PDF as

> cabbages$Year <- recode(cabbages$Year, "\"X2001\"=\"2001\";\"X2002\"=\"2002\";\"X2003\"=\"2003\";\ etc

And obviously isn't working as printing out incorrectly.

Can anyone suggest what is happening here.

Many thanks,


Graham M Smith

Station Cottage, Station Road
Binegar, Somerset

Reply via email to