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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.