[R] Recode Variable

S Ellison S.Ellison at LGCGroup.com
Thu Apr 12 12:44:21 CEST 2012



> myData[myData$var1==5;"var1"]<-NA             # recode value "5" into "NA"
try 
myData[!is.na(myData$var1) & myData$var1==5;"var1"]<-NA
or, more simply,
myData$var1[myData$var1==5]<-NA

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list