[R] Extract index column the max

MSousa ricardosousa2000 at clix.pt
Wed Mar 28 17:18:06 CEST 2012


Hello, I have this data.frame, and i need the value the column where the
value in matrix is maximum

res3     
      77 86 93 106 161
  77  20  0  0   1   0
  86   1 12  1   2   1
  93   0  2  3   3   0
  106  0  4  3  18   0
  161  0  0  0   1  55

  I use  this d<-which(res3==max(res3), arr.ind=T)
> d
    row col
161   5   5 

how do I return only the value 161
   Thanks


--
View this message in context: http://r.789695.n4.nabble.com/Extract-index-column-the-max-tp4512573p4512573.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list