# Example comparing a 4 cluster average-linkage solution
# and a 5 cluster Ward-linakage solution
avg <- hclust(dist(USArrests), "ave")
avg.4 <- as.matrix(cutree(avg, k = 4))
war <- hclust(dist(USArrests), "ward.D")
war.5 <- as.matrix(cutree(war, k = 5))
ba <- best.agreement(avg.4, war.5, test = TRUE)
ba
Run the code above in your browser using DataLab