"closepairs"(X, rmax, twice=TRUE, what=c("all", "indices"), distinct=TRUE, neat=TRUE, ...)
"crosspairs"(X, Y, rmax, what=c("all", "indices"), ...)
"pp3"
).
twice=TRUE
, each pair will appear twice
in the output, as (i,j)
and again as (j,i)
. If
twice=FALSE
, then each pair will appear only once,
as the pair (i,j)
such that i < j
.
what="all"
(the default) then the
returned information includes the indices i,j
of each pair,
their x,y,z
coordinates, and the distance between them.
If what="indices"
then only the indices i,j
are returned.
i
and j
(distinct=TRUE
, the default) or to also include
the pairs where i=j
(distinct=FALSE
).
i < j
in each output pair, when twice=FALSE
.
i
and j
,
and possibly other components as described under Details.
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. closepairs(X,rmax)
identifies all pairs of neighbours
in the pattern X
and returns them. The result is
a list with the following components:
If what="indices"
then only the components i
and
j
are returned. This is slightly faster.
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
.
closepairs
X <- pp3(runif(10), runif(10), runif(10), box3(c(0,1)))
Y <- pp3(runif(10), runif(10), runif(10), box3(c(0,1)))
a <- closepairs(X, 0.1)
b <- crosspairs(X, Y, 0.1)
Run the code above in your browser using DataLab