Message-ID: <65BF6CCA-8CBF-4169-9791-0966A867F358@comcast.net>
Date: 2013-01-11T18:36:30Z
From: David Winsemius
Subject: locating element in distance matrix
In-Reply-To: <BLU170-W588577ABA5E996722F58C189290@phx.gbl>
On Jan 11, 2013, at 9:55 AM, eliza botto wrote:
>
> Dear useRs,
> I have a very basic question. I have a distance matrix and i skipped
> the upper part of it deliberately.
I have no idea what htat means. Code is always helpful in resolving
ambiguities.
> 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.
> Thanks in advance
?which
which( distmat == min(distmat), arr.ind=TRUE)
(It's possible to have more than one match and it would be up to you
to decide how to break ties.)
--
David Winsemius, MD
Alameda, CA, USA