distance {SpatialAcc} | R Documentation |
Distance Matrix Computation
Description
Computes Euclidean or Manhattan distances for all pairs of points between two sets of points.
Usage
distance(m1, m2, type = "euclidean")
Arguments
m1 |
a vector referring to a set of origin point coordinates |
m2 |
a vector referring to a set of destination point coordinates |
type |
the type of distance to be computed. Two types are currently supported "euclidean" and "manhattan". |
Details
When m1 and m2 are identical, the function is equivalent to the dist
function of base R.
Value
A distances matrix in which rows refer to origins and columns refer to destinations.
Author(s)
Stamatis Kalogirou <stamatis.science@gmail.com>
See Also
dist
in stats.
Examples
m1<-cbind(c(1:10),c(1:10))
m2<-cbind(sample(20:80,4),sample(20:80,4))
d<-distance(m1,m2)
[Package SpatialAcc version 0.1-5 Index]