optimal_k | R Documentation |
This function is designed to find the optimal number of clusters in K-means clustering using the elbow method.
optimal_k(data, max.k, title = "Elbow Method for Finding the Optimal k")
data |
A numeric |
max.k |
The max number of clusters to consider. |
title |
A character string of the elbow plot title. |
A ggplot.
Jianhai Zhang jzhan067@ucr.edu
Dr. Thomas Girke thomas.girke@ucr.edu
H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2016.
data <- iris[, 1:4]
dat.scl <- scale(data)
optimal_k(dat.scl, 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.