How can I randomly create categorical variables in R?
Below I randomly create a variable that is composed of the values "m" and "f", which stand for male and female.
sex <- sample(letters[c(6,13)], 10000, replace=TRUE)
But how can I enter the values in words, as in "male" and "female"?
Aucun commentaire:
Enregistrer un commentaire