View source: R/compute_silhoutte.R
| compute_silhouette | R Documentation |
Calculates the average silhouette coefficient from a silhouette object.
compute_silhouette(sil)
sil |
A silhouette object as returned by |
A numeric value indicating the average silhouette width, or NA if input is NULL.
data <- scale(iris[, 1:4])
cl <- kmeans(data, 3)$cluster
sil <- cluster::silhouette(cl, dist(data))
if (interactive()) {
compute_silhouette(sil)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.