View source: R/kmeans_diagnostics.R

avg_silhouette | R Documentation |

Measures average silhouette between clusters

avg_silhouette(.data, clusters, distance = "euclidean")

`.data` |
A data frame |

`clusters` |
The column containing cluster assignments. |

`distance` |
The distance metric to use. (Currently only "euclidean") |

The average of all cluster silhouettes.

kmeans_spec <- k_means(k = 5) %>% set_engine_celery("stats") kmeans_fit <- fit(kmeans_spec, ~., mtcars) mtcars %>% augment(kmeans_fit) %>% silhouettes(.cluster)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.