spatstat / spatstat.geom

Sub-package of spatstat defining spatial data and spatial/geometrical operations
7 stars 4 forks source link

Bug in `nncross.ppp` when `iX, iY` are given #4

Closed baddstats closed 3 years ago

baddstats commented 3 years ago

nncross.ppp produces wrong answers in the following example:

A <- data.frame(
          m= c("K", "K", "A1", "A2", "G", "A2", "A3"),
          x=c(4.85, 6.76, 10.58, 19.18, 15.74, 19.08, 12.27),
          y=c(5.60, 12.92, 11.14, 17.22, 5.74, 1.24, 2.20),
         stringsAsFactors=TRUE
 )
 X <- with(A, ppp(x, y, marks=m, window=bounding.box.xy(x, y)))
 wrong <- nncross(X, X[7], iX=1:7, iY=7L)$dist
 right <- pairdist(X)[,7]
 right[7] <- Inf
 right
 wrong
baddstats commented 3 years ago

Bug is fixed in development version spatstat.geom 2.0-1.005