[R] Translating recoding syntax from SPSS to R

Mosi Ifatunji ifatunji at gmail.com
Sun Sep 22 00:03:30 CEST 2013


Colleagues,

I am in the process of learning R. I've been able to import my dataset (from Stata) and do some simple coding. I have now come to coding situation that requires some assistance. This is some code in SPSS that I would like to be able to execute in R:

if (race eq 1 and usborn=0) confused=1 .
if (race eq 2 and usborn=0) confused=1 .
if (race eq 1 and usborn=1) confused=0 .
if (race eq 2 and usborn=1) confused=0 .
if (race eq 3 and usborn=1) confused=0 .
if (race eq 3 and cohort=1) confused=0 .
if (race eq 3 and cohort=2) confused=0 .
variable labels confused "R claims to be both an African American and foriegn born" .
value labels confused
	1 "Both AfAm and Foreign"
	2 "Not" .
select if (confused eq 0) .

Any assistance would be greatly appreciated.

-- Mosi


More information about the R-help mailing list