0

I have a dataframe with a multiple values, and one column with the largest of these values. I do not know, however, which of the columns the largest value came from. I would like to be able to create a variable stating which of the columns is an exact match. This is likely best explained with an example.

VALUEONE VALUETWO VALUETHREE VALUEFOUR LARGEST
6.76 3.29 4.66 6.777 6.777
1.2 4.3 5.6 1.9 5.6
10 3.99 7.9 2.1 10

In this example the largest in the first row is 6.77 from VALUEFOUR, 5.6 from VALUETHREE in the second row and 10 from VALUEONE in the third row. I would like to be able to code to create a variable that will say this, for instance to create the dataframe below.

VALUEONE VALUETWO VALUETHREE VALUEFOUR LARGEST WHICH_VALUE_LARGEST
6.76 3.29 4.66 6.777 6.777 VALUEFOUR
1.2 4.3 5.6 1.9 5.6 VALUETHREE
10 3.99 7.9 2.1 10 VALUEONE

I was wondering if anyone might be able to help?

DW1310
  • 147
  • 7

0 Answers0