closepaircounts(X, r)crosspaircounts(X, Y, r)
closepairs(X, rmax, ...)
## S3 method for class 'ppp':
closepairs(X, rmax, twice=TRUE,
what=c("all","indices","ijd"),
distinct=TRUE, neat=TRUE, ...)
crosspairs(X, Y, rmax, ...)
## S3 method for class 'ppp':
crosspairs(X, Y, rmax, what=c("all", "indices", "ijd"), ...)
"ppp").twice=TRUE (the default),
each pair will appear twice in the output, as (i,j)
and again as (j,i). If twice=Fwhat="all" (the default) then the
returned information includes the indices i,j of each pair,
their x,y coordinates, and the disi and j
(distinct=TRUE, the default) or to also include
the pairs where i=j (distinct=FALSEi < j
in each output pair, when twice=FALSE.closepaircounts and crosspaircounts, an integer
vector of length equal to the number of points in X. For closepairs and crosspairs,
a list with components 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.
closepaircounts(X,r) counts the number of neighbours for
each point in the pattern X. That is, for each point
X[i], it counts the number of other points X[j]
with j != i such that d(X[i],X[j]) <= r<="" code=""> where
d denotes Euclidean distance. The result is an integer vector
v such that v[i] is the number of neighbours of
X[i].=>
crosspaircounts(X,Y,r) counts, for each point
in the pattern X, the number of neighbours in the pattern
Y. That is, for each point
X[i], it counts the number of points Y[j]
such that d(X[i],X[j]) <= r<="" code="">. The result is an integer vector
v such that v[i] is the number of neighbours of
X[i] in the pattern Y.=>
closepairs(X,rmax) identifies all pairs of distinct neighbours
in the pattern X and returns them. The result is
a list with the following components:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
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.
closepairs.pp3 for the corresponding
functions for 3D point patterns.
Kest, Kcross,
nndist, nncross,
applynbd, markstat
for functions which use these capabilities.a <- closepaircounts(cells, 0.1)
sum(a)
Y <- split(amacrine)
b <- crosspaircounts(Y$on, Y$off, 0.1)
d <- closepairs(cells, 0.1)
e <- crosspairs(Y$on, Y$off, 0.1)Run the code above in your browser using DataLab