Creates a tidy dataframe containing information at the cluster level for a kmeans clustering algorithm

tidy_kmeans(Model, X)

Arguments

Model

A kmeans object created by stats::kmeans().

X

data.frame of the original data set.

Value

tibble of infomration associated with each cluster

Examples

library(dplyr) library(sptidy) data(iris) data <- iris %>% select(-Species) kclust <- kmeans(data, centers = 3) tidy_kmeans(kclust, data)
#> # A tibble: 3 x 3 #> cluster_number cluster_center n_points #> <int> <list> <int> #> 1 1 <dbl [3]> 33 #> 2 2 <dbl [3]> 21 #> 3 3 <dbl [3]> 96