cell_cell_distances.Rd
Find the mean distance to k nearest neighbours
cell_cell_distances(cells, k)
sf
object. Does not have to include intermediate cells (e.g.
for stomata, can be stomatal cells only).
Numeric. The k nearest neighbours to calculate distances to.
If k
is a single value, returns a vector of same length as
cells
, containing the distance (in pixels, microns etc, depending on image scale) between each cell and its
kth nearest neighbour. If k
is a vector, returns a matrix with
length(k)
variables, with the distance from each
cell to its nearest k neighbours.
This code can be very slow if cells
contains many polygons
or k
has more than two values.