Pruning A Hierarchical Cluster Tree — How to Segment Dendrogram Leafs in R Programming

The cutree and fviz_cluster functions in R programming can segment your dendrogram to suit your cluster analysis needs.

Pierre DeBois
5 min readSep 3, 2023
Dendrogram can be segmented by color to identify clusters alongside the degree observations are near or far from each other

I explained how to create dendrograms with R programming in an earlier post — they are useful in clustering given observations into statistically identifiable groups, indicating which observations are near or far from each other. The size of a dendrogram can get lengthy with many variables displayed. Many times you will have to reduce the number of leaves displayed to highlight a segment for visualization or to remove a section of observations that are not essential to the analysis. This is where the cutree() function comes into play.

Splitting The Dendrogram — The cutree() Function

The cutree() function takes a dendrogram object and adjusts either the number of groups displayed from a desired number of clusters or the number of heights (clades) in the dendrogram. If you are unfamiliar with dendrograms, you should check out my dendrogram post which explains the value of a dendrogram and how they are crafted.

The function is applied on a hclust() object. The cutree() parameters indicate where a…

--

--

Pierre DeBois
Pierre DeBois

Written by Pierre DeBois

#analytics |#datascience |#JS |#rstats |#marketing services for #smallbiz | #retail | #nonprofits Contrib @CMSWire @smallbiztrends #blackbusiness #BLM