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.36,0.67,0.58,0.55,0.80,0.80,0.80,0.80,0.55,0.64,0.89,0.50,0.58,0.55,0.39,0.39,0.36,0.36,0.44,0.36,0.19,0.36,0.36,0.44,0.28,0.22,0.36,0.36,0.36,0.19,0.36,0.36,0.36,0.36,0.36,0.44,0.44,0.55,0.44,0.33,0.39,0.44,0.55,0.55,0.64,0.64,0.44,0.64,0.80,0.80,1.00),dim=c(1,51),dimnames=list(c('ESTETICOS'),1:51)) > y <- array(NA,dim=c(1,51),dimnames=list(c('ESTETICOS'),1:51)) > 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 = '20' > par1 = 'ward' > ylab = 'height' > xlab = 'cases' > main = 'ATRUBUTOS ESTETICOS' > par4 <- 'FALSE' > par3 <- 'FALSE' > par2 <- '20' > 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 51 members at h = 5.2] |--[dendrogram w/ 2 branches and 29 members at h = 0.824] | |--[dendrogram w/ 2 branches and 3 members at h = 0.04] | | |--leaf "26" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "21" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 26 members at h = 0.734] | |--[dendrogram w/ 2 branches and 7 members at h = 0] | | |--leaf "47" | | `--[dendrogram w/ 2 branches and 6 members at h = 0] | | |--leaf "42" | | `--[dendrogram w/ 2 branches and 5 members at h = 0] | | |--leaf "39" | | `--[dendrogram w/ 2 branches and 4 members at h = 0] | | |--leaf "37" | | `--[dendrogram w/ 2 branches and 3 members at h = 0] | | |--leaf "36" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "19" | | `--leaf "24" | `--[dendrogram w/ 2 branches and 19 members at h = 0.155] | |--[dendrogram w/ 2 branches and 2 members at h = 0.05] | | |--leaf "25" | | `--leaf "40" | `--[dendrogram w/ 2 branches and 17 members at h = 0.148] | |--[dendrogram w/ 2 branches and 14 members at h = 0] | | |--leaf "35" | | `--[dendrogram w/ 2 branches and 13 members at h = 0] | | |--leaf "34" | | `--[dendrogram w/ 2 branches and 12 members at h = 0] | | |--leaf "33" | | `--[dendrogram w/ 2 branches and 11 members at h = 0] | | |--leaf "32" | | `--[dendrogram w/ 2 branches and 10 members at h = 0] | | |--leaf "31" | | `--[dendrogram w/ 2 branches and 9 members at h = 0] | | |--leaf "29" | | `--[dendrogram w/ 2 branches and 8 members at h = 0] | | |--leaf "28" | | `--[dendrogram w/ 2 branches and 7 members at h = 0] | | |--leaf "27" | | `--[dendrogram w/ 2 branches and 6 members at h = 0] | | |--leaf "23" | | `--[dendrogram w/ 2 branches and 5 members at h = 0] | | |--leaf "22" | | `--[dendrogram w/ 2 branches and 4 members at h = 0] | | |--leaf "20" | | `--[dendrogram w/ 2 branches and 3 members at h = 0] | | |--leaf "18" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "1" | | `--leaf "17" | `--[dendrogram w/ 2 branches and 3 members at h = 0] | |--leaf "41" | `--[dendrogram w/ 2 branches and 2 members at h = 0] | |--leaf "15" | `--leaf "16" `--[dendrogram w/ 2 branches and 22 members at h = 1.99] |--[dendrogram w/ 2 branches and 8 members at h = 0.352] | |--[dendrogram w/ 2 branches and 6 members at h = 0] | | |--leaf "50" | | `--[dendrogram w/ 2 branches and 5 members at h = 0] | | |--leaf "49" | | `--[dendrogram w/ 2 branches and 4 members at h = 0] | | |--leaf "8" | | `--[dendrogram w/ 2 branches and 3 members at h = 0] | | |--leaf "7" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "5" | | `--leaf "6" | `--[dendrogram w/ 2 branches and 2 members at h = 0.11] | |--leaf "11" | `--leaf "51" `--[dendrogram w/ 2 branches and 14 members at h = 0.514] |--[dendrogram w/ 2 branches and 5 members at h = 0.048] | |--leaf "2" | `--[dendrogram w/ 2 branches and 4 members at h = 0] | |--leaf "48" | `--[dendrogram w/ 2 branches and 3 members at h = 0] | |--leaf "46" | `--[dendrogram w/ 2 branches and 2 members at h = 0] | |--leaf "10" | `--leaf "45" `--[dendrogram w/ 2 branches and 9 members at h = 0.0965] |--[dendrogram w/ 2 branches and 2 members at h = 0] | |--leaf "3" | `--leaf "13" `--[dendrogram w/ 2 branches and 7 members at h = 0.0857] |--leaf "12" `--[dendrogram w/ 2 branches and 6 members at h = 0] |--leaf "44" `--[dendrogram w/ 2 branches and 5 members at h = 0] |--leaf "43" `--[dendrogram w/ 2 branches and 4 members at h = 0] |--leaf "38" `--[dendrogram w/ 2 branches and 3 members at h = 0] |--leaf "14" `--[dendrogram w/ 2 branches and 2 members at h = 0] |--leaf "4" `--leaf "9" > mysub <- paste('Method: ',par1) > postscript(file="/var/wessaorg/rcomp/tmp/1ja2r1447693799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=13.888888888889,height=13.888888888889) > 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/2jqj31447693799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=13.888888888889,height=13.888888888889) + 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 20 members at h = 2] |--[dendrogram w/ 2 branches and 12 members at h = 0.579] | |--[dendrogram w/ 2 branches and 3 members at h = 0.04] | | |--leaf 13 | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf 11 | | `--leaf 14 | `--[dendrogram w/ 2 branches and 9 members at h = 0.362] | |--[dendrogram w/ 2 branches and 5 members at h = 0] | | |--leaf 19 | | `--[dendrogram w/ 2 branches and 4 members at h = 0] | | |--leaf 18 | | `--[dendrogram w/ 2 branches and 3 members at h = 0] | | |--leaf 16 | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf 10 | | `--leaf 15 | `--[dendrogram w/ 2 branches and 4 members at h = 0.0881] | |--leaf 12 | `--[dendrogram w/ 2 branches and 3 members at h = 0.0367] | |--leaf 9 | `--[dendrogram w/ 2 branches and 2 members at h = 0.03] | |--leaf 1 | `--leaf 17 `--[dendrogram w/ 2 branches and 8 members at h = 0.753] |--[dendrogram w/ 2 branches and 3 members at h = 0.191] | |--leaf 20 | `--[dendrogram w/ 2 branches and 2 members at h = 0.09] | |--leaf 5 | `--leaf 7 `--[dendrogram w/ 2 branches and 5 members at h = 0.191] |--[dendrogram w/ 2 branches and 2 members at h = 0.03] | |--leaf 2 | `--leaf 6 `--[dendrogram w/ 2 branches and 3 members at h = 0.0622] |--leaf 8 `--[dendrogram w/ 2 branches and 2 members at h = 0.03] |--leaf 3 `--leaf 4 > > #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/37nwx1447693799.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/4b4lc1447693799.tab") + } > > try(system("convert tmp/1ja2r1447693799.ps tmp/1ja2r1447693799.png",intern=TRUE)) character(0) > try(system("convert tmp/2jqj31447693799.ps tmp/2jqj31447693799.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.462 0.215 1.679