[R] Finding an index of matrix[i,j]
Ben Bolker
ben at zoo.ufl.edu
Fri Oct 26 22:15:30 CEST 2001
which(x,arr.ind=TRUE)
On Fri, 26 Oct 2001, Wolfgang Viechtbauer wrote:
> I hope somebody can help me out with this. Let's say I have a matrix with
> i rows and j columns and I want to find the index of the row AND column of
> the maximum value in the matrix. I tried to play around with the which()
> command, but couldn't find an easy solution that didn't involve loops and
> various other inelegant approaches. I hope that there is an easy way of
> doing this. Thanks in advance for any suggestions!
>
> ------------------------------------------------------------------------
> Wolfgang Viechtbauer wviechtb at s.psych.uiuc.edu
> Department of Quantitative Psychology viechtba at students.uiuc.edu
>
> University of Illinois, Champaign-Urbana [Virus based on an honors-
> Room 409, Psychology Building system: Forward this to 10
> 603 E. Daniel Street random people and delete a
> Champaign, IL 61820 bunch of your files. Thanks.]
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
318 Carr Hall bolker at zoo.ufl.edu
Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker
Box 118525 (ph) 352-392-5697
Gainesville, FL 32611-8525 (fax) 352-392-3704
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list