nnmark {spatstat.geom}R Documentation

Mark of Nearest Neighbour

Description

Given a marked point pattern dataset X this function computes, for each desired location y, the mark attached to the nearest neighbour of y in X. The desired locations y can be either a pixel grid or the point pattern X itself.

Usage

nnmark(X, ..., k = 1, at=c("pixels", "points"))

Arguments

X

A marked point pattern (object of class "ppp").

...

Arguments passed to as.mask to determine the pixel resolution.

k

Single integer. The kth nearest data point will be used.

at

String specifying whether to compute the values at a grid of pixel locations (at="pixels") or only at the points of X (at="points").

Details

Given a marked point pattern dataset X this function computes, for each desired location y, the mark attached to the point of X that is nearest to y. The desired locations y can be either a pixel grid or the point pattern X itself.

The argument X must be a marked point pattern (object of class "ppp", see ppp.object). The marks are allowed to be a vector or a data frame.

If the argument k is given, then the k-th nearest neighbour will be used.

Value

If X has a single column of marks:

If X has a data frame of marks:

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au

Rolf Turner rolfturner@posteo.net

and Ege Rubak rubak@math.aau.dk

See Also

Smooth.ppp, marktable, nnwhich

Examples

  plot(nnmark(ants))
  v <- nnmark(ants, at="points")
  v[1:10]
  plot(nnmark(finpines))
  vf <- nnmark(finpines, at="points")
  vf[1:5,]

[Package spatstat.geom version 3.2-9 Index]