spdep_nb | R Documentation |
construct neighbours list
spdep_nb(sfj, queen = TRUE, k = NULL, order = 1L, cumulate = TRUE)
sfj |
An |
queen |
(optional) if |
k |
(optional) The number of nearest neighbours. Ignore this parameter when not using distance based neighbours. |
order |
(optional) The order of the adjacency object. Default is |
cumulate |
(optional) Whether to accumulate adjacency objects. Default is |
A neighbours list with class nb
When k
is set to a positive value, using K-Nearest Neighbor
pts = sf::read_sf(system.file('extdata/pts.gpkg',package = 'sdsfun'))
nb1 = spdep_nb(pts, k = 6)
nb2 = spdep_nb(pts, queen = TRUE)
nb3 = spdep_nb(pts, queen = FALSE, order = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.