Make spatially constrained clusters from spatially non-constrained clusters using the contiguity information from the input weights

make_spatial(clusters, w)

Arguments

clusters

A cluster classification variable (categorical values from a dataframe or values returned from cluster functions)

w

An instance of Weight class

Value

A vector of categorical values (cluster classification)

Examples

if (FALSE) {
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
}