so I have a variable that is split into multiple categories (eight columns/categories in total). I am trying to combine these eight variables into one and then compare the lowest values to the highest values in regression. I apologize for the bad formatting. In other words, if the person had exam type 1, in the exam type column if someone had exam 1, it would be listed as 1, someone had exam 2, it would be listed as 2, etc...
Here is an example of how the data looks like (only listing three columns for the sake of simplicity and they are coded as 0,1:
examtype_1| examtype_2|examtype_3
---------------------------------
0 0 1
1 0 0
What I expect my final column to look like:
exam type
--------------
1
2
3
4
5
6
7
8
2
4
8
4
2
Is there a way to do this without dummy coding it?
I am thinking of something like but am not sure how to proceed with the 0,1 coding above:
clean_df <- df %>% mutate(exam_type = c("examtype_1","examtype_2","examtype_3","examtype_4","examtype_5","examtype_6","examtype_7","examtype_8"))
#I know that this will not work
any advice is greatly appreciated.