How do I change a value coded as "Yes" to a value of 1 in R?
r
Solution
If you want to use `ifelse`,
CA <- ifelse(CANCER=="Yes", 1, 2)
Problem
The variables in my database are coded as "Yes" and "No" but I would like to have as "1" and "2". I tried to create a new variable using `ifelse` but when I `list`'ed it, it didn't work, as follows: ``` CA <- ifelse((CANCER == "Yes"),1 ifelse(( CANCER == "No"),2 ))) list(CA) [[1]] NULL ```