library(gapminder)
library(dplyr)
clusters <- gapminder %>%
widely_kmeans(country, year, lifeExp, k = 5)
clusters
clusters %>%
count(cluster)
# Examine a few clusters
clusters %>% filter(cluster == 1)
clusters %>% filter(cluster == 2)
Run the code above in your browser using DataLab