[R] locating element in distance matrix
bhh at xs4all.nl
Fri Jan 11 19:08:56 CET 2013
On 11-01-2013, at 18:55, eliza botto <eliza_botto at hotmail.com> wrote:
> Dear useRs,
> I have a very basic question. I have a distance matrix and i skipped the upper part of it deliberately. The distance matrix is 1000*1000. Then i used "min" command to extract the lowest value from that matrix. Now i want to know what is the location of that lowest element? More precisely, the row and column number of that lowest element.
If you had looked at the help of min you could have seen that which.min could be useful.
and from See also
so this will do it
mat <- matrix(runif(25),nrow=5)
More information about the R-help