[R] Apostrophes in R Commander in recode

Simon Kiss sjkiss at gmail.com
Fri Jul 29 17:32:00 CEST 2011


Dear colleagues, 

I'm using R64 (2.13) on Mac OS 10.6.8 and I've encountered a problem with the recode function in Rcommander.  The application cannot deal with apostrpohes ( ' ) do not.  I've got a factor from the 2008 Canada Election study (highest level of schooling) and some of the values include "Bachelor's Degree" , "Master's Degree".

I've troubleshooted (shot?) the recode function for all the levels and it's really the apostrophe that is the problem. 

When entering "Bachelor's Degree"=1, I get the error message 

[39] ERROR: Use only double-quotes (" ") in recode directives

I see also that the same problem exists in recode from the command line.

There are two ways I can solve this myself, but neither are both are a bit more complex than the context requires (e.g. exercises for an undergraduate class). I can use gsub from the command line to remove the apostrophes, or i can  import the data file without using value labels as factor levels and that would doubtless work.  But the technical documentation for the CES is very poor; my students would have to end up opening up the original .sav file in PASW and hunt down what the underlying factor levels refer to in that instance.  

Is there a solution within R Commander?
Yours, Simon Kiss
*********************************
Simon J. Kiss, PhD
Assistant Professor, Wilfrid Laurier University
73 George Street
Brantford, Ontario, Canada
N3T 2C9
Cell: +1 905 746 7606



More information about the R-help mailing list