How it works...

The hierarchical clustering technique tries to build a hierarchy of clusters iteratively using either of the following two approaches:

  • Agglomerative hierarchical clustering: This is a bottom-up approach. Each observation starts in its own cluster. We then compute the similarity (or the distance) between each cluster and then merge the two most similar ones at each iteration until there is only one cluster left.
  • Divisive hierarchical clustering: This is a top-down approach. All observations start in one cluster, and we then split the cluster into the two least dissimilar clusters recursively until there is one cluster for each observation.

In this recipe, we perform hierarchical clustering on the European protein intake data. ...

Get R Data Analysis Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.