powered by
Performs hierarchical clustering with tidy output
tidy_hclust(data, method = "average", distance = "euclidean", cols = NULL)
A list of class "tidy_hclust" containing:
model: hclust object
dist: distance matrix used
method: linkage method used
data: original data (for plotting)
A data frame, tibble, or dist object
Agglomeration method: "ward.D2", "single", "complete", "average" (default), "mcquitty", "median", "centroid"
Distance metric if data is not a dist object (default: "euclidean")
Columns to include (tidy select). If NULL, uses all numeric columns.
# Basic hierarchical clustering hc_result <- tidy_hclust(USArrests, method = "average") # With specific distance hc_result <- tidy_hclust(mtcars, method = "complete", distance = "manhattan")
Run the code above in your browser using DataLab