Calculate K-Nearest NeighborsSource:
k nearest neighbors for given point geometry. If polygon geometry is provided, the centroids of the polygon will be used and a warning will be emitted.
an sf or sfc object.
number of nearest neighbours to be returned
FALSE. Whether to force output of neighbours to be symmetric.
additional arguments to be passed to
st_knn(sf::st_geometry(guerry), k = 8) #> ! Polygon provided. Using point on surface. #> Neighbour list object: #> Number of regions: 85 #> Number of nonzero links: 680 #> Percentage nonzero weights: 9.411765 #> Average number of links: 8 #> Non-symmetric neighbours list