factoextra is an R package for extracting and visualizing multivariate-analysis results, including K-means clustering. It complements built-in clustering functions with practical diagnostic and plotting tools. section 11.1 section 20.1
Use factoextra to:
- Compare candidate cluster counts with fviz_nbclust() using within-cluster sum of squares or silhouette methods. section 11.5.2
- Visualize assigned clusters with fviz_cluster() after computing a K-means solution. section 11.5.2
- Combine diagnostic plots with patchwork for side-by-side or vertically arranged comparisons. section 11.5.2
NBA payroll and wins
For NBA teams, fviz_nbclust() compares possible values of K from payroll and regular-season wins. The within-cluster sum of squares suggests six clusters, while the silhouette method suggests two. Choosing K = 4, fviz_cluster() displays standardized payroll-and-wins groups, including a separate New York Knicks cluster and a larger group containing the San Antonio Spurs. section 11.5.2 section 20.1
library(tidyverse) library(scales) library(patchwork) library(factoextra)
Load factoextra alongside tidyverse, scales, and patchwork before importing and inspecting the data. section 11.1
