I have a factor of males and females say c("male", "female","female") and I want to create a vector of c(0,1,1) How can i change that in r?
With boolean :
a <- c("male", "female","female") (a=="female")*1
hth
2.1m questions
2.1m answers
60 comments
57.0k users