compute_silhouette: Compute Average Silhouette Width

View source: R/compute_silhoutte.R

compute_silhouetteR Documentation

Compute Average Silhouette Width

Description

Calculates the average silhouette coefficient from a silhouette object.

Usage

compute_silhouette(sil)

Arguments

sil

A silhouette object as returned by silhouette.

Value

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

Examples

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



clusterWebApp documentation built on Aug. 8, 2025, 6:09 p.m.