[R] search in matrix

Florent Bresson f_bresson at yahoo.fr
Thu Dec 29 17:20:52 CET 2005


I'm dealing with a matrix like :

     "x"  "y"  "z"
[1,]  2    4     1
[2,]  6    1     2
...
[n,]  7    3     1

For each row I would like to know the header of the
column which corresponds to the minimum value. In the
case of my matrix, I would like to obtain the
following vector :

z y ... z

Any idea ?




More information about the R-help mailing list