This lab will teach you how to apply and use hierarchical clustering (HC) on a game dataset.

There are many different R implementations of HC; we’re going to use the following functions:

  • hclust from the built-in stats package.
  • agnes and diana from the cluster package

Brief refresher

Unlike partitional methods, HC doesn’t produce a single clustering result. Its output takes the form of a tree structure called a dendrogram that represents how the data can be grouped based on their similarity. Users can select a within-cluster similarity value to cut the tree, which results in one specific clustering result. Therefore, there can be many clustering results one can deduce from one resultant tree.


We first load the following packages (install if you need to).

Get hands-on with 1200+ tech skills courses.