compute_gapstat {visxhclust}R Documentation

Compute Gap statistic for clustered data

Description

Compute Gap statistic for clustered data

Usage

compute_gapstat(df, clusters, gap_B = 50, max_k = 14)

Arguments

df

the data used to compute clusters

clusters

output of compute_clusters() or fastcluster::hclust()

gap_B

number of bootstrap samples for cluster::clusGap() function. Default is 50.

max_k

maximum number of clusters to compute the statistic. Default is 14.

Value

a data frame with the Tab component of cluster::clusGap() results

Examples

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)

[Package visxhclust version 1.1.0 Index]