ww_build_neighbors {waywiser} | R Documentation |
Make 'nb' objects from sf objects
Description
These functions can be used for geographic or projected coordinate reference systems and expect 2D data.
Usage
ww_build_neighbors(data, nb = NULL, ..., call = rlang::caller_env())
Arguments
data |
An sf object (of class "sf" or "sfc"). |
nb |
An object of class "nb" (in which case it will be returned
unchanged), or a function to create an object of class "nb" from |
... |
Arguments passed to the neighbor-creating function. |
call |
The execution environment of a currently running
function, e.g. You only need to supply Can also be For more information about error calls, see Including function calls in error messages. |
Details
When nb = NULL
, the method used to create neighbors from data
is
dependent on what geometry type data
is:
If
nb = NULL
anddata
is a point geometry (classes "sfc_POINT" or "sfc_MULTIPOINT") the "nb" object will be created usingww_make_point_neighbors()
.If
nb = NULL
anddata
is a polygon geometry (classes "sfc_POLYGON" or "sfc_MULTIPOLYGON") the "nb" object will be created usingww_make_polygon_neighbors()
.If
nb = NULL
anddata
is any other geometry type, the "nb" object will be created using the centroids of the data as points, with a warning.
Value
An object of class "nb".
Examples
ww_build_neighbors(guerry)