nbmatrix: Construct Neighbourhood Matrix from Polygons
Description
Building a neighbourhood matrix based on regions (polygons) with contiguous boundaries and resulting a data frame
Usage
nbmatrix(
polygon_sf,
ID_col,
row.names = NULL
)
Value
list with two entries:
nb:
Object of class "sb" Neighbours list; see the spdep:poly2nb documentation
nbmat:
Object of class "data.frame" Dataset neighbouring regions
Arguments
polygon_sf
sf object with polygons
ID_col
Column of polygon_sf with unique ID of each polygon
row.names
row.names for the sf object
Author
Thomas Wieland
Details
The function is based on spdep::poly2nb, which creates neighbours lists. The input is a sf object (spatial data frame) and the results are 1) a nb list (poly2nb result) and 2) a data.frame.
References
Wieland T (2020) Flatten the Curve! Modeling SARS-CoV-2/COVID-19 Growth in Germany at the County Level. REGION 7(2), 43–83. tools:::Rd_expr_doi("https://doi.org/10.18335/region.v7i2.324")
Wieland T (2022) Spatial patterns of excess mortality in the first year of the COVID-19 pandemic in Germany. European Journal of Geography 13(4), 18-33. tools:::Rd_expr_doi("https://doi.org/10.48088/ejg.t.wie.13.4.018.033")