nearNeighb | R Documentation |
Find nearest neighbours within a radius
nearNeighb(x, y = NULL, k = NULL, radius = NULL, zones = NULL)
x |
two column matrix of individual x and y coordinates |
y |
optional two column matrix of individual x and y coordinates |
k |
number of neighbours to search for, starting from nearest in
coordinate space. If NULL, |
radius |
radius to look for nearest neighbours, in units of XY
coordinates. If |
zones |
number of zones of equal arc angle, e.g. |
If y
is provided, nearest neighbours of individuals in
y
are identified for each individual in x
, otherwise,
nearest neighbours in x
are identified.
In the case of ties, the first nearest neighbour is returned.
List of dataframes per focal individual in x, of neighbours, their distances and angles relative to the focal individual. If no competitors are found within the radius of a focal individual, NA is returned for all columns except focal ID.
data(bicuar)
nearNeighb(bicuar[,c("x", "y")], k = 4)
nearNeighb(bicuar[1:10, c("x", "y")], bicuar[, c("x", "y")], radius = 5)
nearNeighb(bicuar[,c("x", "y")], radius = 5, zones = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.