Learn R Programming

rgeoda (version 0.1.0)

make_spatial: 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)

Value

A vector of categorical values (cluster classification)

Arguments

clusters

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

w

An instance of Weight class

Examples

Run this code
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
}

Run the code above in your browser using DataLab