[R] Recoding -- test whether number begins with a certain number

Marcel Gerds Marcel.Gerds at gmx.de
Wed Nov 3 11:01:08 CET 2010


  Dear R community,

I have a question concerning recoding of a variable. I have a data set
in which there is a variable devoted to the ISCO code describing the
occupation of this certain individual
(http://www.ilo.org/public/english/bureau/stat/isco/isco88/major.htm).
Every type of occupation begins with a number and every number added to
this number describes th occupation more detailed.
Now my problem: I want to recode this variable in a way that every value
beginning with a certain number is labeled as the respective category.
For example, that all values of this variable beginning with a 6 is
labeled as "agri".
My problem is that I cannot find a test which I can use for that purpose.

I would really appreciate any help on that subject. Thank you.

Best regards
Marcel Gerds



More information about the R-help mailing list