spatial weight matrix based on geographical complexity
Arguments
- gc
Geographical complexity vector.
- wt
Spatial weight matrix based on spatial adjacency or spatial distance relationships.
- style
(optional) A character that can be
B,W,C. More to seespdep::nb2mat(). Default isW.
Examples
econineq = sf::read_sf(system.file('extdata/econineq.gpkg',package = 'geocomplexity'))
gc = econineq %>%
dplyr::select(Gini) %>%
geocd_vector(returnsf = FALSE) %>%
dplyr::pull(1)
#> Warning: neighbour object has 2 sub-graphs;
#> if this sub-graph count seems unexpected, try increasing the snap argument.
wt = sdsfun::spdep_contiguity_swm(econineq,style = 'B')
#> Warning: neighbour object has 2 sub-graphs;
#> if this sub-graph count seems unexpected, try increasing the snap argument.
wt_gc = geoc_swm(gc,wt)
wt_gc[1:5,1:5]
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.0000000 0.1078564 0.1050683 0.1051201 0.1129214
#> [2,] 0.1926769 0.0000000 0.1883360 0.0000000 0.0000000
#> [3,] 0.2540007 0.2548663 0.0000000 0.0000000 0.0000000
#> [4,] 0.1698465 0.0000000 0.0000000 0.0000000 0.1784286
#> [5,] 0.1183268 0.0000000 0.0000000 0.1157179 0.0000000
