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"),
                 ties=c("first", "mean", "min", "max"),
                 proper=FALSE)

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").

ties

Character string (partially matched) indicating how to handle the case of ties, where there are two or more data points at the same location. See Details.

proper

Logical value specifying how to define nearest neighbours if there are two or more data points at the same location. Applies only when at="points". See Details.

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.

The arguments ties and proper specify how to handle the case where two or more data points are at the same spatial location.

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.5-0 Index]