[R] Find the index for min of a matrix

From: kate <yhsu6_at_uiuc.edu>
Date: Sun, 30 Mar 2008 22:53:02 -0500


Hi,

My example is as the following,

W<-matrix(c(2,4,2,8,1,3),ncol=3)
which(W==min(W))

I would like to find the index for min of the matrix W, i.e. (1, 3) instead of 5 as the output. What command could I use?

Thanks,

Kate

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 31 Mar 2008 - 03:57:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 31 Mar 2008 - 04:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive