Hi,

I was looking for a solution to the same problem. I just found something and
thought it might be useful to share.

Suppose you look for the positions of the minimum value in matrix D. Using a
little euclide division solves the problem easily. Here is my code.

min(D)
Dv=as.vector(D)
pos=which.min(Dv)
j0=floor(pos/nrow(D))+1
i0=pos%%nrow(D)
D[i0,j0] # must equal min(D)

Hope this is useful.

I.

--
View this message in context: 
http://r.789695.n4.nabble.com/locating-minimum-value-in-matrix-tp850619p3921598.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

Reply via email to