Assume i have the following dataset:
dt<-data.frame(X=sample(4),Y=sample(4))
when i run dist on it with
dist(dt, method = "euclidean")
it gives me a matrix like:
1 2 3
2 3.162278
3 2.236068 3.605551
4 2.236068 2.236068 1.414214
I need to know, what are the N'th minimum pair
for example the first minimum pair are: (1,3) with distance 1.414214
the second pairs are (2,4), and (1,4) with 2.236068
and so on ....
So, how can i have this function?