spdep_skater {sdsfun} | R Documentation |
SKATER forms clusters by spatially partitioning data that has similar values for features of interest.
spdep_skater(sfj, k = 6, nb = NULL, ini = 5, ...)
sfj |
An |
k |
(optional) The number of clusters. Default is |
nb |
(optional) A neighbours list with class nb. If the input |
ini |
(optional) The initial node in the minimal spanning tree. Defaul is |
... |
(optional) Other parameters passed to spdep::skater(). |
A numeric vector of clusters.
library(sf)
gzma = read_sf(system.file('extdata/gzma.gpkg',package = 'sdsfun'))
gzma_c = spdep_skater(gzma,8)
gzma$group = gzma_c
plot(gzma["group"])