Define neighbour relationships according to K-nearest neighbour algorithm.

knn_nb(poly, k = 20)

Arguments

poly

a sf data frame with polygon geometry

k

numeric, number of nearest neighbour to select with knn algorithm

Value

weighted neighbour matrix in a listw object from spdep package

Details

based on knearneigh function from spdep package

See also

Other nb_funcs: centroid_nb(), membrane_nb(), nb_expand(), nb_update(), queen_nb(), tri_nb()