nndist(x, y=NULL, method="C")
x
and y
would be
numeric vectors of equal length. Alternatively y
may be
omitted and x
may be
a point patter"C"
and "interpreted"
. If method = "interpreted"
then the distances are
computed using interpreted R code only. If method="C"
then C code is used. The C code is faster by two to three orders of magnitude
and uses much less memory.
If there is only one point (if x
has length 1),
then a nearest neighbour distance of Inf
is returned.
If there are no points (if x
has length zero)
a numeric vector of length zero is returned.
pairdist
,
Gest
x <- runif(100)
y <- runif(100)
d <- nndist(x, y)
data(cells)
d <- nndist(cells)
Run the code above in your browser using DataLab