| edm_nearest | R Documentation |
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)
m1 |
The first |
m2 |
The second |
full |
|
So far this function is quite time consumming since it performs n
\times n euclidean distance computation. If one wishes to align two (or
more shapes) Procrustes surimposition may provide a better solution.
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.
ed, edm, dist.
x <- matrix(1:10, nc=2)
edm_nearest(x, x+rnorm(10))
edm_nearest(x, x+rnorm(10), full=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.