一键导入
cluster
R cluster package for clustering algorithms. Use for PAM, CLARA, AGNES, DIANA, and other clustering methods.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
R cluster package for clustering algorithms. Use for PAM, CLARA, AGNES, DIANA, and other clustering methods.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
R language data analysis and visualization skill. Use when user asks to (1) run R scripts or code, (2) install/update R packages, (3) perform data analysis with R, (4) create visualizations with ggplot2/plotly, (5) statistical analysis, (6) data manipulation with tidyverse/dplyr/data.table. Triggers on keywords like "R语言", "R脚本", "ggplot", "tidyverse", "数据分析", "可视化".
R DALEX package for model explanations. Use for explaining complex machine learning models.
R iml package for interpretable ML. Use for model-agnostic interpretability methods.
R lime package for local explanations. Use for explaining individual predictions with local interpretable models.
R packages for ML interpretability. Use for explaining and interpreting machine learning models.
R vip package for variable importance. Use for computing and visualizing variable importance scores.
| name | cluster |
| description | R cluster package for clustering algorithms. Use for PAM, CLARA, AGNES, DIANA, and other clustering methods. |
Finding groups in data.
library(cluster)
# PAM clustering
pam_result <- pam(data, k = 3)
# Results
pam_result$clustering # Cluster assignments
pam_result$medoids # Medoid points
pam_result$silinfo # Silhouette info
# Plot
plot(pam_result)
# CLARA for large datasets
clara_result <- clara(data, k = 3, samples = 50)
# Results
clara_result$clustering
clara_result$medoids
# Agglomerative (AGNES)
agnes_result <- agnes(data, method = "ward")
plot(agnes_result)
cutree(agnes_result, k = 3)
# Divisive (DIANA)
diana_result <- diana(data)
plot(diana_result)
cutree(diana_result, k = 3)
# Fuzzy c-means
fanny_result <- fanny(data, k = 3)
# Membership matrix
fanny_result$membership
# Hard clustering
fanny_result$clustering
# Compute silhouette
sil <- silhouette(clustering, dist(data))
# Summary
summary(sil)
# Plot
plot(sil)
# Average silhouette width
mean(sil[, 3])
# Compute distances
d <- daisy(data)
# Mixed data types
d <- daisy(data, metric = "gower")
# With weights
d <- daisy(data, weights = c(1, 2, 1))
# Gap statistic
gap_stat <- clusGap(data, FUN = pam, K.max = 10, B = 50)
plot(gap_stat)
# Optimal k
maxSE(gap_stat$Tab[, "gap"], gap_stat$Tab[, "SE.sim"])
# Cluster plot
clusplot(data, clustering,
color = TRUE,
shade = TRUE,
labels = 2,
lines = 0)