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
1.4m articles
1.4m replys
5 comments
57.0k users