[R] Recoding variable levels in R

David Barron david.barron at jesus.ox.ac.uk
Mon Jan 7 13:22:50 CET 2002


Use the recode function in the car package.

David

----- Original Message -----
From: "Stuart Leask" <stuart.leask at nottingham.ac.uk>
To: <r-help at stat.math.ethz.ch>
Sent: Monday, January 07, 2002 12:06 PM
Subject: [R] Recoding variable levels in R


> Hi there. When I wished to recode two variables in SPSS, I could use the
> command RECODE:
>
> recode VAR1 VAR2 VAR3 etc. (1=0) (2=1) (3,MISSING=SYSMIS) (else=0).
>
> In R, I can 'hand-crank' each variable (using ifelse, or if the data is in
a
> matrix by logical tests, or no doubt numerous other methods) one variable
> and one level at a time, but is there a more general function available?
>
> Stuart
>
> Dr Stuart Leask MA MRCPsych, Clinical Lecturer in Psychiatry
> University of Nottingham Dept of Psychiatry, Duncan Macmillan House
> Porchester Road, Nottingham. NG3 6AA. UK
> http://www.nottingham.ac.uk/psychiatry/staff/sjl.html
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
>
>

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list