Re: [R] how to extract the maximum from a matrix?

2007-06-01 Thread Dimitris Rizopoulos
look at the `arr.ind' argument of ?which(), e.g., x - matrix(rnorm(9), 3, 3) x which(x == max(x), arr.ind = TRUE) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35,

[R] how to extract the maximum from a matrix?

2007-06-01 Thread mirko sanpietrucci
Dear UseRs, I have a very simple question. I have a big matrix (say x) including probabilities (values in (0,1)). I have to store in a list the names of the row and the column where max(x) is located. How can I proceed? Thanks in advance for your assistance! mirko