Learn R Programming

ggfortify (version 0.4.17)

fortify.silhouette: Convert cluster::silhouette to data.frame

Description

Convert cluster::silhouette to data.frame

Usage

# S3 method for silhouette
fortify(model, data = NULL, ...)

Value

data.frame

Arguments

model

Silhouette instance

data

original dataset, if needed

...

other arguments passed to methods

Examples

Run this code
if (FALSE) {
fortify(cluster::silhouette(cluster::pam(iris[-5], 3)))
fortify(cluster::silhouette(cluster::clara(iris[-5], 3)))
fortify(cluster::silhouette(cluster::fanny(iris[-5], 3)))

mod = stats::kmeans(iris[-5], 3)
fortify(cluster::silhouette(mod$cluster, stats::dist(iris[-5])))
}

Run the code above in your browser using DataLab