Make Spatial
Make spatially constrained clusters from spatially non-constrained clusters using the contiguity information from the input weights
make_spatial(clusters, w)
clusters
: A cluster classification variable (categorical values from a dataframe or values returned from cluster functions)w
: An instance of Weight classA vector of categorical values (cluster classification)
## Not run: library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) data <- guerry[c('Crm_prs','Crm_prp','Litercy','Donatns','Infants','Suicids')] clusters <- kmeans(5, data) queen_w <- queen_weights(guerry) results <- make_spatial(clusters, queen_w) results ## End(Not run)
Useful links