Learn R Programming

clusterWebApp (version 0.1.3)

compute_silhouette: Compute Average Silhouette Width

Description

Calculates the average silhouette coefficient from a silhouette object.

Usage

compute_silhouette(sil)

Value

A numeric value indicating the average silhouette width, or NA if input is NULL.

Arguments

sil

A silhouette object as returned by silhouette.

Examples

Run this code
data <- scale(iris[, 1:4])
cl <- kmeans(data, 3)$cluster
sil <- cluster::silhouette(cl, dist(data))
if (interactive()) {
  compute_silhouette(sil)
}


Run the code above in your browser using DataLab