spdep_contiguity_swm | R Documentation |
Constructs spatial weight matrices based on contiguity via spdep
package.
spdep_contiguity_swm(
sfj,
queen = TRUE,
k = NULL,
order = 1L,
cumulate = TRUE,
style = "W",
zero.policy = TRUE
)
sfj |
An |
queen |
(optional) if |
k |
(optional) The number of nearest neighbours. Ignore this parameter when not using distance based neighbours to construct spatial weight matrices. |
order |
(optional) The order of the adjacency object. Default is |
cumulate |
(optional) Whether to accumulate adjacency objects. Default is |
style |
(optional) |
zero.policy |
(optional) if |
A matrix
When k
is set to a positive value, using K-Nearest Neighbor Weights.
gzma = sf::read_sf(system.file('extdata/gzma.gpkg',package = 'sdsfun'))
wt1 = spdep_contiguity_swm(gzma, k = 6, style = 'B')
wt2 = spdep_contiguity_swm(gzma, queen = TRUE, style = 'B')
wt3 = spdep_contiguity_swm(gzma, queen = FALSE, order = 2, style = 'B')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.