Skip to content
Prev 332517 / 398506 Next

find max value in each row and return column number and column name

On Nov 1, 2013, at 10:03 AM, Gary Dong wrote:

            
cbind(a, max=apply(a,1,max),
         max.col.num =apply(a,1,which.max) ,
         max.col.name= names(a)[apply(a,1,which.max)]  )
You can express your appreciation by posting in plain-text in the future.
David Winsemius
Alameda, CA, USA