R version 3.2.2 (2015-08-14) -- "Fire Safety" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(0.33 + ,0.66 + ,0.66 + ,0.33 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.25 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.25 + ,0.25 + ,0.00 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.33 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,1.00 + ,1.00 + ,1.00 + ,0.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.50 + ,0.50 + ,0.50 + ,1.00 + ,1.00 + ,0.00 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.00 + ,0.00 + ,0.00 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.00 + ,0.50 + ,0.50 + ,1.00 + ,0.50 + ,0.50 + ,0.50 + ,1.00 + ,0.00 + ,1.00 + ,1.00 + ,0.00 + ,0.00 + ,0.75 + ,0.00 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,0.66 + ,1.00 + ,1.00 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.33 + ,0.33 + ,0.66 + ,0.33 + ,0.66 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,0.25 + ,0.66 + ,0.25 + ,0.25 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,0.66 + ,1.00 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.33 + ,0.00 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,0.00 + ,0.75 + ,0.25 + ,0.50 + ,0.75 + ,0.50 + ,0.75 + ,0.75 + ,1.00 + ,0.75 + ,1.00 + ,1.00 + ,0.75 + ,0.50 + ,0.00 + ,0.33 + ,0.00 + ,0.25 + ,0.25 + ,0.00 + ,0.00 + ,0.33 + ,0.00 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.00 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.50 + ,0.75 + ,0.50 + ,1.00 + ,0.00 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,0.33 + ,0.75 + ,0.75 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.25 + ,0.75 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.33 + ,0.00 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,0.25 + ,0.75 + ,0.50 + ,0.50 + ,0.75 + ,0.75 + ,0.75 + ,0.75 + ,1.00 + ,0.75 + ,1.00 + ,0.75 + ,0.50 + ,0.50 + ,0.33 + ,0.33 + ,0.25 + ,0.25 + ,0.50 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.50 + ,0.33 + ,0.33 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.25 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.33 + ,0.50 + ,0.50 + ,0.50 + ,0.75 + ,0.75 + ,0.50 + ,0.75 + ,0.75 + ,0.75 + ,1.00 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.00 + ,0.50 + ,1.00 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.00 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.00 + ,0.50 + ,0.50 + ,0.50 + ,0.00 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,0.50 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.75 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,0.33 + ,0.66 + ,1.00 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.33 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,1.00 + ,0.33 + ,0.66 + ,0.66 + ,0.33 + ,0.66 + ,0.00 + ,0.33 + ,0.00 + ,0.33 + ,0.66 + ,0.00 + ,0.33 + ,0.33 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.33 + ,0.33 + ,0.75 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,0.33 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.66 + ,1.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.33 + ,0.66 + ,0.33 + ,0.66 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.66 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.66 + ,0.75 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.00 + ,0.33 + ,0.00 + ,0.00 + ,0.33 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,1.00 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.33 + ,0.66 + ,0.66 + ,1.00 + ,0.66 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,0.00 + ,0.33 + ,0.75 + ,0.00 + ,0.66 + ,0.33 + ,1.00 + ,0.66 + ,1.00 + ,0.66 + ,0.66 + ,0.33 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.33 + ,0.00 + ,0.00 + ,0.00 + ,0.33 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.33 + ,0.66 + ,0.66 + ,0.66 + ,0.66 + ,1.00 + ,1.00 + ,1.00 + ,1.00) + ,dim=c(51 + ,16) + ,dimnames=list(c('1' + ,'2' + ,'3' + ,'4' + ,'5' + ,'6' + ,'7' + ,'8' + ,'9' + ,'10' + ,'11' + ,'12' + ,'13' + ,'14' + ,'15' + ,'16' + ,'17' + ,'18' + ,'19' + ,'20' + ,'21' + ,'22' + ,'23' + ,'24' + ,'25' + ,'26' + ,'27' + ,'28' + ,'29' + ,'30' + ,'31' + ,'32' + ,'33' + ,'34' + ,'35' + ,'36' + ,'37' + ,'38' + ,'39' + ,'40' + ,'41' + ,'42' + ,'43' + ,'44' + ,'45' + ,'46' + ,'47' + ,'48' + ,'49' + ,'50' + ,'51') + ,1:16)) > y <- array(NA,dim=c(51,16),dimnames=list(c('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51'),1:16)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par4 = 'FALSE' > par3 = 'FALSE' > par2 = '15' > par1 = 'ward' > ylab = 'height' > xlab = 'cases' > main = 'Dendrogram' > par4 <- 'FALSE' > par3 <- 'FALSE' > par2 <- '15' > par1 <- 'ward' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa, P., (2012), Hierarchical Clustering (v1.0.3) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_hierarchicalclustering.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > par3 <- as.logical(par3) > par4 <- as.logical(par4) > if (par3 == 'TRUE'){ + dum = xlab + xlab = ylab + ylab = dum + } > x <- t(y) > hc <- hclust(dist(x),method=par1) The "ward" method has been renamed to "ward.D"; note new "ward.D2" > d <- as.dendrogram(hc) > str(d) --[dendrogram w/ 2 branches and 16 members at h = 8.13] |--[dendrogram w/ 2 branches and 2 members at h = 1.99] | |--leaf "10" | `--leaf "13" `--[dendrogram w/ 2 branches and 14 members at h = 4.89] |--[dendrogram w/ 2 branches and 3 members at h = 1.84] | |--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 1.58] | |--leaf "11" | `--leaf "12" `--[dendrogram w/ 2 branches and 11 members at h = 3.22] |--[dendrogram w/ 2 branches and 9 members at h = 2.4] | |--[dendrogram w/ 2 branches and 2 members at h = 1.36] | | |--leaf "4" | | `--leaf "5" | `--[dendrogram w/ 2 branches and 7 members at h = 2.28] | |--leaf "16" | `--[dendrogram w/ 2 branches and 6 members at h = 1.93] | |--[dendrogram w/ 2 branches and 3 members at h = 1.68] | | |--leaf "1" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.4] | | |--leaf "6" | | `--leaf "15" | `--[dendrogram w/ 2 branches and 3 members at h = 1.83] | |--leaf "3" | `--[dendrogram w/ 2 branches and 2 members at h = 1.22] | |--leaf "7" | `--leaf "8" `--[dendrogram w/ 2 branches and 2 members at h = 2.6] |--leaf "2" `--leaf "9" > mysub <- paste('Method: ',par1) > postscript(file="/var/wessaorg/rcomp/tmp/113dr1447954623.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > if (par4 == 'TRUE'){ + plot(d,main=main,ylab=ylab,xlab=xlab,horiz=par3, nodePar=list(pch = c(1,NA), cex=0.8, lab.cex = 0.8),type='t',center=T, sub=mysub) + } else { + plot(d,main=main,ylab=ylab,xlab=xlab,horiz=par3, nodePar=list(pch = c(1,NA), cex=0.8, lab.cex = 0.8), sub=mysub) + } > dev.off() null device 1 > if (par2 != 'ALL'){ + if (par3 == 'TRUE'){ + ylab = 'cluster' + } else { + xlab = 'cluster' + } + par2 <- as.numeric(par2) + memb <- cutree(hc, k = par2) + cent <- NULL + for(k in 1:par2){ + cent <- rbind(cent, colMeans(x[memb == k, , drop = FALSE])) + } + hc1 <- hclust(dist(cent),method=par1, members = table(memb)) + de <- as.dendrogram(hc1) + postscript(file="/var/wessaorg/rcomp/tmp/2lmi71447954623.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + if (par4 == 'TRUE'){ + plot(de,main=main,ylab=ylab,xlab=xlab,horiz=par3, nodePar=list(pch = c(1,NA), cex=0.8, lab.cex = 0.8),type='t',center=T, sub=mysub) + } else { + plot(de,main=main,ylab=ylab,xlab=xlab,horiz=par3, nodePar=list(pch = c(1,NA), cex=0.8, lab.cex = 0.8), sub=mysub) + } + dev.off() + str(de) + } The "ward" method has been renamed to "ward.D"; note new "ward.D2" --[dendrogram w/ 2 branches and 15 members at h = 7.92] |--[dendrogram w/ 2 branches and 2 members at h = 1.99] | |--leaf 9 | `--leaf 12 `--[dendrogram w/ 2 branches and 13 members at h = 4.79] |--[dendrogram w/ 2 branches and 3 members at h = 1.84] | |--leaf 13 | `--[dendrogram w/ 2 branches and 2 members at h = 1.58] | |--leaf 10 | `--leaf 11 `--[dendrogram w/ 2 branches and 10 members at h = 3.15] |--[dendrogram w/ 2 branches and 8 members at h = 2.33] | |--[dendrogram w/ 2 branches and 2 members at h = 1.36] | | |--leaf 4 | | `--leaf 5 | `--[dendrogram w/ 2 branches and 6 members at h = 2.19] | |--leaf 15 | `--[dendrogram w/ 2 branches and 5 members at h = 1.82] | |--leaf 3 | `--[dendrogram w/ 2 branches and 4 members at h = 1.68] | |--leaf 1 | `--[dendrogram w/ 2 branches and 3 members at h = 1.52] | |--leaf 14 | `--[dendrogram w/ 2 branches and 2 members at h = 1.32] | |--leaf 6 | `--leaf 7 `--[dendrogram w/ 2 branches and 2 members at h = 2.6] |--leaf 2 `--leaf 8 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Summary of Dendrogram',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Label',header=TRUE) > a<-table.element(a,'Height',header=TRUE) > a<-table.row.end(a) > num <- length(x[,1])-1 > for (i in 1:num) + { + a<-table.row.start(a) + a<-table.element(a,hc$labels[i]) + a<-table.element(a,hc$height[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/wessaorg/rcomp/tmp/3o4pm1447954623.tab") > if (par2 != 'ALL'){ + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Summary of Cut Dendrogram',2,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Label',header=TRUE) + a<-table.element(a,'Height',header=TRUE) + a<-table.row.end(a) + num <- par2-1 + for (i in 1:num) + { + a<-table.row.start(a) + a<-table.element(a,i) + a<-table.element(a,hc1$height[i]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/wessaorg/rcomp/tmp/4kla21447954623.tab") + } > > try(system("convert tmp/113dr1447954623.ps tmp/113dr1447954623.png",intern=TRUE)) character(0) > try(system("convert tmp/2lmi71447954623.ps tmp/2lmi71447954623.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.035 0.179 1.216