Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nnfromvertex

Nearest Data Point From Each Vertex in a Network


Description

Given a point pattern on a linear network, for each vertex of the network find the nearest data point.

Usage

nnfromvertex(X, what = c("dist", "which"), k = 1)

Arguments

X

Point pattern on a linear network (object of class "lpp").

what

Character string specifying whether to return the nearest-neighbour distances, nearest-neighbour identifiers, or both.

k

Integer, or integer vector, specifying that the kth nearest neighbour should be returned.

Details

For each vertex (node) of the linear network, this algorithm finds the nearest data point to the vertex, and returns either the distance from the vertex to its nearest neighbour in X, or the serial number of the nearest neighbour in X, or both.

If k is an integer, then the k-th nearest neighbour is found instead.

If k is an integer vector, this is repeated for each integer in k.

Value

A numeric vector, matrix, or data frame.

Author(s)

See Also

Examples

X <- runiflpp(5, simplenet)
  nnfromvertex(X)
  nnfromvertex(X, k=1:3)

spatstat.linnet

Linear Networks Functionality of the 'spatstat' Family

v2.1-1
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Ottmar Cronie [ctb], Tilman Davies [ctb], Greg McSwiggan [ctb], Suman Rakshit [ctb]
Initial release
2021-03-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.