compute_distance_matrix() is a small helper function to help you compute a distance matrix.
For the geographically method to work, is is important that distances between points are not zero. This function allows to add a small random noise to avoid zero distances.
A dataframe or matrix containing at least two numerical columns.
method
method to compute the distance matrix. Ultimately passed to stats::dist(). Can be euclidean, maximum, manhattan, canberra, binary or minkowski.
add.noise
TRUE/FALSE set to TRUE to add a small noise to the distance matrix. Noise \(U\) is generated as \( U \sim (1\times 10^{-6}, 5\times 10^{-6})\).
Noise is added only for pairs for which distance is zero.