Let I have a data frame(df1)
df1:
v1 v2 v3 v4
-- -- -- --
4.1 1.2 12 1.4
14 18.4 15.1 6.9
I want to find nth largest value of each row and also column name of that value.
Foe example, let say I want to find second largest value of each row and related column name. So the output(df2) sould be:
df2:
value col_name
--- --------
4.1 v1
15.1 v3
How can I do that using R? I will be very glad for any help. Thanks a lot.