Given a pattern of points on a linear network, compute the nearest-neighbour distances, measured by the shortest path in the network.
Point pattern on linear network (object of class
Integer, or integer vector. The algorithm will compute the distance to the
Optional. A factor, which separates
Optional string determining the method of calculation.
Given a pattern of points on a linear network, this function computes the nearest neighbour distance for each point (i.e. the distance from each point to the nearest other point), measuring distance by the shortest path in the network.
method="C" the distances are computed using
code in the C language. If
method="interpreted" then the
computation is performed using interpreted R code. The R code is
much slower, but is provided for checking purposes.
kth nearest neighbour distance is infinite
kth nearest neighbour does not exist. This can occur
if there are fewer than
k+1 points in the dataset, or if
the linear network is not connected.
If the argument
by is given, it should be a
of length equal to the number of points in
This factor effectively partitions
X into subsets,
each subset associated with one of the levels of
The algorithm will then compute, for each point of
the distance to the nearest neighbour in each subset.
A numeric vector, of length equal to the number of points in
or a matrix, with one row for each point in
X and one column
for each entry of
k. Entries are nonnegative numbers or
1 2 3 4 5 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.