cat1<-factor(sample(c("None","Low","Medium","High","Extreme"),40,TRUE),
levels=c("None","Low","Medium","High","Extreme"))
cat2<-factor(sample(c("None","Low","Medium","High"),40,TRUE),
levels=c("None","Low","Medium","High"))
cat3<-factor(sample(c("None","Low","High"),40,TRUE),
levels=c("None","Low","High"))
hcats<-data.frame(cat1,cat2,cat3)
# throw in a few NAs
hcats$cat1[10]<-NA
hcats$cat2[c(15,20)]<-NA
hcats$cat3[c(11,14,25)]<-NA
bhcol<-list(c("#ff8080","#dddd80","#80ff80","#0000ff","#80dddd"),
c("#ff8080","#dddd80","#80ff80","#0000ff"),
c("#ff8080","#dddd80","#0000ff"))
sizetree(hcats,col=bhcol,main="Hierarchical count chart (sizetree)")
Run the code above in your browser using DataLab