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