| distance | R Documentation |
Computes Euclidean or Manhattan distances for all pairs of points between two sets of points.
distance(m1, m2, type = "euclidean")
m1 |
a matrix or data frame containing origin point coordinates in the first two columns. |
m2 |
a matrix or data frame containing destination point coordinates in the first two columns. |
type |
the type of distance to be computed. Two types are currently supported: |
When m1 and m2 are identical, the function is equivalent to the dist function of base R.
A distance matrix in which rows refer to origins and columns refer to destinations.
Stamatis Kalogirou <stamatis.science@gmail.com>
dist in stats.
m1 <- cbind(1:10, 1:10)
m2 <- cbind(c(20, 40, 60, 80), c(25, 45, 65, 85))
d <- distance(m1, m2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.