When I have a distance matrix (or a data frame based on a matrix), how do I get the row and column that corresponds to a given value?
Example:
df <- data.frame(x = c(11:20), y= c(12:21))
dst <- dist(df)
Output:
1 2 3 4 5 6 7 8 9 2 1.414214 3 2.828427 1.414214 4 4.242641 2.828427 1.414214 5 5.656854 4.242641 2.828427 1.414214 6 7.071068 5.656854 4.242641 2.828427 1.414214 7 8.485281 7.071068 5.656854 4.242641 2.828427 1.414214 8 9.899495 8.485281 7.071068 5.656854 4.242641 2.828427 1.414214 9 11.313708 9.899495 8.485281 7.071068 5.656854 4.242641 2.828427 1.414214 10 12.727922 11.313708 9.899495 8.485281 7.071068 5.656854 4.242641 2.828427 1.414214
Now I want to input e.g. 11.313708 and get as output (9, 1)