# maxnndist: Compute Minimum or Maximum Nearest-Neighbour Distance

### Description

A faster way to compute the minimum or maximum nearest-neighbour distance in a point pattern.

### Usage

 ```1 2``` ```minnndist(X, positive=FALSE) maxnndist(X, positive=FALSE) ```

### Arguments

 `X` A point pattern (object of class `"ppp"`). `positive` Logical. If `FALSE` (the default), compute the usual nearest-neighbour distance. If `TRUE`, ignore coincident points, so that the nearest neighbour distance for each point is greater than zero.

### Details

These functions find the minimum and maximum values of nearest-neighbour distances in the point pattern `X`. `minnndist(X)` and `maxnndist(X)` are equivalent to, but faster than, `min(nndist(X))` and `max(nndist(X))` respectively.

The value is `NA` if `npoints(X) < 2`.

### Value

A single numeric value (possibly `NA`).

### Author(s)

, \rolf and \ege.

`nndist`

### Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ``` min(nndist(swedishpines)) minnndist(swedishpines) max(nndist(swedishpines)) maxnndist(swedishpines) minnndist(lansing, positive=TRUE) if(interactive()) { X <- rpoispp(1e6) system.time(min(nndist(X))) system.time(minnndist(X)) } ```

Search within the spatstat package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.