Skip to content
Back to skills

Factoextra

ASecurity

R factoextra package for cluster visualization. Use for visualizing clustering results and PCA.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added June 4, 2026
data

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill factoextra --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Factoextra?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Factoextra
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-factoextra/badge)](https://www.skillsdirectory.com/skills/leolin990405-factoextra)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: factoextra
description: R factoextra package for cluster visualization. Use for visualizing clustering results and PCA.
---

# factoextra

Extract and visualize multivariate analyses.

## Optimal Clusters

```r
library(factoextra)

# Elbow method
fviz_nbclust(data, kmeans, method = "wss")

# Silhouette method
fviz_nbclust(data, kmeans, method = "silhouette")

# Gap statistic
fviz_nbclust(data, kmeans, method = "gap_stat")
```

## K-Means Visualization

```r
# Perform k-means
km <- kmeans(data, centers = 3)

# Visualize clusters
fviz_cluster(km, data = data)

# With options
fviz_cluster(km, data = data,
  palette = "jco",
  ellipse.type = "convex",
  repel = TRUE,
  ggtheme = theme_minimal())
```

## Hierarchical Clustering

```r
# Compute distances
d <- dist(data)

# Hierarchical clustering
hc <- hclust(d, method = "ward.D2")

# Dendrogram
fviz_dend(hc, k = 3,
  cex = 0.5,
  color_labels_by_k = TRUE,
  rect = TRUE)

# Circular dendrogram
fviz_dend(hc, k = 3, type = "circular")

# Phylogenic
fviz_dend(hc, k = 3, type = "phylogenic")
```

## Silhouette Plot

```r
# Silhouette
sil <- silhouette(km$cluster, dist(data))

# Visualize
fviz_silhouette(sil)
```

## PCA Visualization

```r
# PCA
pca <- prcomp(data, scale = TRUE)

# Scree plot
fviz_eig(pca)

# Individuals
fviz_pca_ind(pca,
  col.ind = "cos2",
  gradient.cols = c("blue", "yellow", "red"))

# Variables
fviz_pca_var(pca,
  col.var = "contrib",
  gradient.cols = c("blue", "yellow", "red"))

# Biplot
fviz_pca_biplot(pca)
```

## Contribution

```r
# Variable contributions
fviz_contrib(pca, choice = "var", axes = 1)

# Individual contributions
fviz_contrib(pca, choice = "ind", axes = 1:2)
```

## Other Methods

```r
# PAM
pam_result <- pam(data, k = 3)
fviz_cluster(pam_result)

# CLARA
clara_result <- clara(data, k = 3)
fviz_cluster(clara_result)

# FANNY
fanny_result <- fanny(data, k = 3)
fviz_cluster(fanny_result)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.