Examples‎ > ‎

Hierarchical Clustering

This page demonstrates hierarchical clustering with R.
Draw a sample of 40 records from iris data, and remove variable Species
> idx <- sample(1:dim(iris)[1], 40)
> irisSample <- iris[idx,]
> irisSample$Species <- NULL


Hierarchical clustering
> hc <- hclust(dist(irisSample), method="ave")
> plot(hc, hang = -1, labels=iris$Species[idx])




More examples on data clustering with R and other data mining techniques can be found in my book "R and Data Mining: Examples and Case Studies", which is downloadable as a .PDF file at the link.