ww_make_point_neighbors: Make 'nb' objects from point geometries
Description
This function uses spdep::knearneigh()
and spdep::knn2nb()
to
create a "nb" neighbors list.
Usage
ww_make_point_neighbors(data, k = 1, sym = FALSE, ...)
Value
An object of class "nb"
Arguments
- data
An sfc_POINT
or sfc_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
Run this codeww_make_point_neighbors(ny_trees)
Run the code above in your browser using DataLab