To return the column name of the largest value for each row, you can use the following
colnames(DF)[apply(DF,1,which.max)]
[1] "V3" "V1" "V2"
You can also use the max.col function as follows:
colnames(DF)[max.col(DF,ties.method="first")]
[1] "V3" "V1" "V2"
If you have more than one column that has maximum values, then only the first column name will be printed.i.e.,
colnames(DF)[apply(DF,1,which.max)]
[1] "V2" "V1" "V2"
Where,
apply(DF,1,function(x) which(x==max(x)))
[[1]]
V2 V3
2 3
[[2]]
V1
1
[[3]]
V2
2