# Combine Titanic passenger attributes into a single category
# and create a contingency table for the non-zero levels
tab <- t(as.data.frame(apply(Titanic, 4:1, FUN=sum)))
tab <- tab[apply(tab, 1, sum) > 0, ]
grc <- greenclust(tab)
greencut(grc)
plot(grc)
rect.hclust(grc, max(greencut(grc)),
border=unique(greencut(grc))+1)
Run the code above in your browser using DataLab