This function uses spdep::knearneigh()
and spdep::knn2nb()
to
create a "nb" neighbors list.
Arguments
- data
An
sfc_POINT
orsfc_MULTIPOINT
object.- k
How many nearest neighbors to use in
spdep::knearneigh()
.- sym
Force the output neighbors list (from
spdep::knn2nb()
) to symmetry.- ...
Other arguments passed to
spdep::knearneigh()
.
Details
These functions can be used for geographic or projected coordinate reference systems and expect 2D data.
Examples
ww_make_point_neighbors(ny_trees)
#> Warning: neighbour object has 1712 sub-graphs
#> Neighbour list object:
#> Number of regions: 5303
#> Number of nonzero links: 5303
#> Percentage nonzero weights: 0.01885725
#> Average number of links: 1
#> 1712 disjoint connected subgraphs
#> Non-symmetric neighbours list