st_block_nb: Create Block Contiguity for Spatial Regimes

View source: R/nb-block-contiguity.R

st_block_nbR Documentation

Create Block Contiguity for Spatial Regimes

Description

libpysal write that "block contiguity structures are relevant when defining neighbor relations based on membership in a regime. For example, all counties belonging to the same state could be defined as neighbors, in an analysis of all counties in the US."

Source: libpysal

Usage

st_block_nb(regime, id = 1:length(regime), diag = FALSE)

Arguments

regime

a column identifying which spatial regime each element of id belongs

id

a column identifying unique observations

diag

default FALSE. If TRUE, includes diagonal element / the self.

Value

An object of class nb. When diag = TRUE the attribute self.included = TRUE.

Examples

id <- guerry$code_dept
regime <- guerry$region
st_block_nb(regime, id)

sfdep documentation built on Jan. 11, 2023, 9:08 a.m.