Run k-means clustering on PUMA centroids and data
kmeans_zone_groups.RdRuns k-means clustering on PUMA centroids and data to assign zone groups for weighting or analysis. Use for creating PUMA groups for expansion.
Value
data.table with columns:
puma_id— PUMA identifier zone_group— assigned group Rows: one per PUMA. Keys: ( puma_id).
Details
Transforms PUMA geometries to projected coordinates.
Merges PUMS data with centroid coordinates.
Determines optimal K if set to 'auto'.
Runs k-means and assigns zone groups.
Returns data.table with PUMA IDs and group assignments.
Returns a copy; does not modify by reference.
See also
get_kmeans_opt_k, scripts/weighting/zone_groups.R
Other clustering utilities:
entropy_zone_groups(),
get_kmeans_opt_k(),
spectral_zone_groups()