Using recode in R

Posted by celenius on Stack Overflow See other posts from Stack Overflow or by celenius
Published on 2010-05-29T16:46:11Z Indexed on 2010/05/29 16:52 UTC
Read the original article Hit count: 308

Filed under:
|

I'm trying to use 'recode' in R (from the 'cars' package) and it is not working. I read in data from a .csv file into a data frame called 'results'. Then, I replace the values in the column 'Built_year', according to the following logic.

recode(results$Built_year, "2 ='1950s';3='1960s';4='1970s';5='1980s';6='1990s';7='2000 or later'")

When I check results$Built_year after doing this step, it appears to have worked. However, it does not store this value, and returns to its previous value. I don't understand why.

Thanks.

(at the moment something is going wrong and I can't see any of the icons for formatting)

© Stack Overflow or respective owner

Related posts about r

    Related posts about statistics