On 02/10/2014 03:03 PM, Ana Genkova wrote:
Hello,

I am trying the ifelse command for imputing a variable based on a
conditional statement, but the NAs do not transform.  The code I am trying
is:

ifelse (x==1, y=="NO", y=="YES").  However, the number of NAs remains the
same after the attempt.   I would like to turn all Y (NAs included) into a
"YES" or a "NO".

Hi Ana,
What you probably want is:

y<-ifelse(x==1,"NO","YES")

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to