This question already has an answer here:
- Generate a dummy-variable 15 answers
I would like to convert this column into binary columns for each breed (1 dog is breed, 0 dog is not that breed)
This question already has an answer here:
I would like to convert this column into binary columns for each breed (1 dog is breed, 0 dog is not that breed)
Use model.matrix() to convert your categorical variable in binary variables.
So dfcat contains your binary variables:
One way could be using
unique
with afor-loop