Computes the matrix of distances between all pairs of points in a point pattern.
pairdist(x, y=NULL, method="C")
- Arguments specifying the $x$ and $y$ coordinates of
a set of points. Typically
ywould be numeric vectors of equal length. Alternatively
ymay be omitted and
xmay be a point patter
- String specifying which method of calculation to use.
This function computes the Euclidean distances between all pairs of points, and returns the matrix of distances.
method = "interpreted" then the distances are
computed using interpreted R code only. If
then C code is used. The C code is marginally faster.
- A square matrix whose
[i,j]entry is the distance between the points numbered
x <- runif(100) y <- runif(100) d <- pairdist(x, y) data(cells) d <- pairdist(cells)