This is a variant of the question presented for matrix before.
I need to find row-wise the first, second, ... biggest values of a dataframe and store each one in a separated new column.
The function I need to build should see as this:
> set.seed(1)
> v1 <- runif(10,1,10)
> v2 <- runif(10,1,10)
> v3 <- runif(10,1,10)
> Dt <- datal.frame( v1, v2, v3 )
> head(Dt, 3)
v1 v2 v3
1 3.390 2.854 9.412
2 4.349 2.589 2.909
3 6.155 7.183 6.865
> label <- big(Dt, pos=1)
#### # big a function to find the first, second, .... (pos) biggets value and returns its label
> label
[1] "v3" "v1" "v2" ...
> big(Dt, pos=2)
[1] "v1" "v3" "v3" ...
Thanks. Juan