O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

There's more...

So far in the recipe, we have used hclust to perform agglomerative hierarchical clustering, but if you would like to perform divisive hierarchical clustering, you can use the diana function from the cluster package.

  1. Install and load the cluster package:
install.packages("cluster") library(cluster)
  1. Then, use diana to perform divisive hierarchical clustering:
dv = diana(proteinIntakeScaled, metric = "euclidean")
  1. Lastly, plot a dendrogram and banner with the plot function:
plot(dv)

Here is the dendrogram using the plot function:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required