Close Pairs of Points
Low-level functions to find all close pairs of points.
closepairs(X, rmax, ...) ## S3 method for class 'ppp' closepairs(X, rmax, twice=TRUE, what=c("all","indices","ijd"), distinct=TRUE, neat=TRUE, periodic=FALSE, ...) crosspairs(X, Y, rmax, ...) ## S3 method for class 'ppp' crosspairs(X, Y, rmax, what=c("all", "indices", "ijd"), ...)
X,Y |
Point patterns (objects of class |
rmax |
Maximum distance between pairs of points to be counted as close pairs. |
twice |
Logical value indicating whether all ordered pairs of close points
should be returned. If |
what |
String specifying the data to be returned for each close pair of points.
If |
distinct |
Logical value indicating whether to return only the
pairs of points with different indices |
neat |
Logical value indicating whether to ensure that |
periodic |
Logical value indicating whether to use the periodic edge correction.
The window of |
... |
Extra arguments, ignored by methods. |
These are the efficient low-level functions used by spatstat to find all close pairs of points in a point pattern or all close pairs between two point patterns.
closepairs(X,rmax)
finds all pairs of distinct points
in the pattern X
which lie at a distance less than or equal to
rmax
apart, and returns them. The result is
a list with the following components:
Integer vector of indices of the first point in each pair.
Integer vector of indices of the second point in each pair.
Coordinates of the first point in each pair.
Coordinates of the second point in each pair.
Equal to xj-xi
Equal to yj-yi
Euclidean distance between each pair of points.
If what="indices"
then only the components i
and
j
are returned. This is slightly faster and more efficient
with use of memory.
crosspairs(X,rmax)
identifies all pairs of neighbours
(X[i], Y[j])
between the patterns X
and Y
,
and returns them. The result is
a list with the same format as for closepairs
.
A list with components i
and j
,
and possibly other components as described under Details.
The results of these functions may not agree exactly with
the correct answer (as calculated by a human) and may not
be consistent between different computers and different installations
of R. The discrepancies arise in marginal cases where the interpoint
distance is equal to, or very close to, the threshold rmax
.
Floating-point numbers in a computer
are not mathematical Real Numbers: they are approximations using
finite-precision binary arithmetic.
The approximation is accurate to a tolerance of about
.Machine$double.eps
.
If the true interpoint distance d and the threshold rmax
are equal, or if their difference is no more than .Machine$double.eps
,
the result may be incorrect.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner r.turner@auckland.ac.nz
closepairs.pp3
for the corresponding
functions for 3D point patterns.
d <- closepairs(cells, 0.1) head(as.data.frame(d)) Y <- split(amacrine) e <- crosspairs(Y$on, Y$off, 0.1)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.