Learn R Programming

msos (version 1.2.0)

sort_silhouette: Sort the silhouettes by group

Description

Sorts the silhouettes, first by group, then by value, preparatory to plotting.

Usage

sort_silhouette(sil, cluster)

Arguments

sil

The \(n\)-vector of silhouette values.

cluster

The \(n\)-vector of cluster indices.

Value

The \(n\)-vector of sorted silhouettes.

See Also

silhouette.km

Examples

Run this code
# NOT RUN {
# Uses sports data.
data(sportsranks)

# Obtain the K-means clustering for sports ranks.
kms <- kmeans(sportsranks, centers = 5, nstart = 10)

# Silhouettes
sil <- silhouette.km(sportsranks, kms$centers)
ssil <- sort_silhouette(sil, kms$cluster)
# }

Run the code above in your browser using DataLab