I am sure this is a very basic question:

I have 600,000 categorical variables in a data.frame - 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?

Thank you!


-- 
Thanks,
CC

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to