
Last chance! 50% off unlimited learning
Sale ends in
edm_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.
edm_nearest(m1, m2, full = FALSE)
list
or matrix
of coordinates.list
or matrix
of coordinates.logical
. Whether to returns a condensed version of the
results.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.
x <- matrix(1:10, nc=2)
edm_nearest(x, x+rnorm(10))
edm_nearest(x, x+rnorm(10), full=TRUE)
Run the code above in your browser using DataLab