hclust

Before creating the actual cluster dendrogram, we have to calculate the distance matrix from our data frame. For this task we use the dist() function:

> dist_xrd <- dist(xrd[-1])

(Note that the first column (label) is left intentionally out with the xrd[-1] syntax, i.e. all columns but the first)

We are ready to create the dendrogram. The syntax is quite plain, even though the console output is not very satisfying. The cluster object is saved to another variable because we are going to plot it.