View source: R/utils_clustering.R
compute_gapstat | R Documentation |
Compute Gap statistic for clustered data
compute_gapstat(df, clusters, gap_B = 50, max_k = 14)
df |
the data used to compute clusters |
clusters |
output of |
gap_B |
number of bootstrap samples for |
max_k |
maximum number of clusters to compute the statistic. Default is 14. |
a data frame with the Tab component of cluster::clusGap()
results
data_to_cluster <- iris[c("Petal.Length", "Sepal.Length")]
dmat <- compute_dmat(data_to_cluster, "euclidean", TRUE)
clusters <- compute_clusters(dmat, "complete")
gap_results <- compute_gapstat(scale(data_to_cluster), clusters)
head(gap_results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.