I have a dataset that consists of 5 dummy variables that looks like this....
> head(type)
convertible coupe hatchback sedan wagon
1 0 0 0 1 0
2 0 1 0 0 0
3 1 0 0 0 0
4 1 0 0 0 0
5 1 0 0 0 0
6 1 0 0 0 0
If I were to use dplyr code, how can I create a new variable that is called "TypeOfCar" with all of the dummy variables collapsed into it? Thanks!
Edit: Sorry for the ambiguity. Using the information above, I was wondering if there was a way in dplyr to gather up the current set of dummy variables to make ONE variable called TypeOfCar. Example below (respective to the ID's above 1-6)
TypeOfCar
1 sedan
2 coupe
3 convertible
4 convertible
5 convertible
6 convertible