make_spatial {rgeoda} | R Documentation |
Make Spatial
Description
Make spatially constrained clusters from spatially non-constrained clusters using the contiguity information from the input weights
Usage
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
## 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)
[Package rgeoda version 0.0.10-4 Index]