0

I have a dataframe as below. I want a fourth column which contains the column name of the max value in that row.

df <- data.frame(tony=c(5,6,9), chuck=c(1,2,7), sam=c(2,9,1))

For example, see the data below. For the first row, max value is for tony, therefore value in the 4th column is tony, and so on.

enter image description here

Vipin Verma
  • 5,330
  • 11
  • 50
  • 92

0 Answers0