Calculates the shortest euclidean distance found for every point of one matrix among those of a second.
Source:R/coo-utilities.R
edm_nearest.Rdedm_nearest calculates the shortest euclidean distance found for
every point of one matrix among those of a second. In other words, if
m1, m2 have n rows, the result will be the shortest distance
for the first point of m1 to any point of m2 and so on,
n times. This function is used internally but may be of interest for
other analyses.
Arguments
- m1
The first
listormatrixof coordinates.- m2
The second
listormatrixof coordinates.- full
logical. Whether to returns a condensed version of the results.
Value
If full is TRUE, returns a list with two
components: d which is for every point of m1 the shortest
distance found between it and any point in m2, and pos the
(m2) row indices of these points. Otherwise returns d as a
numeric vector of the shortest distances.