i need your help, i have a data frame like this
int x y z 1 0 1 0 2 1 0 0 3 0 0 1
and the result that i need must be like thi
You can use max.col:
max.col
dat$newcol <- names(DF)[-1][max.col(DF[-1])]
This gives
int x y z newcol 1 1 0 1 0 y 2 2 1 0 0 x 3 3 0 0 1 z