I have the same request as in this question: For each row return the column name of the largest value
However I need the name of ALL columns holding the maximum value per row. All solutions provided in the link above cause problems if I have two identical max values per row.
df <- data.frame(V1=c(2,8,1,5 , 6),V2=c(7,3,5, 7 , 3),V3=c(7,6,4, 5, 1))
df
V1 V2 V3
1 2 7 7
2 8 3 6
3 1 5 4
4 5 7 5
5 6 3 1
Now, I would like to extract the column names which have the max value. At best as an additional column in the df. Somewhat like this:
> df
V1 V2 V3 Max
1 2 7 7 V3_V2
2 8 3 6 V1
3 1 5 4 V2
4 5 7 5 V2
5 6 3 1 V1
Thank you!