October 2017
Beginner to intermediate
572 pages
26h 1m
English
Perform the following steps to cut the hierarchy of clusters into a given number of clusters:
> fit = cutree(hc, k = 4)
> fit
Output
[1] 1 1 2 1 2 1 2 2 1 1 1 2 2 1 1 1 2 1 2 3 4 3 4 3 3 4 4 3 4
[30] 4 4 3 3 3 4 4 3 4 4 4 4 4 4 4 3 3 4 4 4 3 4 3 3 4 4 4 3 4
[59] 4 3
> table(fit)
Output
fit
1 2 3 4
11 8 16 25
> plot(hc)
> rect.hclust(hc, k = 4 , border="red")

Read now
Unlock full access