In R, I have 600,000 categorical variables, each of which is classified as "0", "1", or "2".
What I would like to do is collapse "1" and "2" and leave "0" by itself, such that after re-categorizing "0" = "0"; "1" = "1" and "2" = "1". In the end I only want "0" and "1" as categories for each of the variables.
Also, if possible, I would rather not create 600,000 new variables, if I can replace the existing variables with the new values that would be great!
What would be the best way to do this?