R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(101 + ,95 + ,106 + ,101 + ,104 + ,96 + ,82 + ,88 + ,99 + ,97 + ,114 + ,108 + ,105 + ,96 + ,118 + ,116 + ,107 + ,96 + ,105 + ,104 + ,111 + ,96 + ,105 + ,110 + ,117 + ,95 + ,103 + ,105 + ,119 + ,97 + ,107 + ,107 + ,127 + ,97 + ,123 + ,124 + ,128 + ,97 + ,112 + ,109 + ,135 + ,98 + ,104 + ,102 + ,132 + ,98 + ,122 + ,125 + ,136 + ,97 + ,108 + ,102 + ,143 + ,98 + ,94 + ,101 + ,142 + ,98 + ,120 + ,116 + ,153 + ,99 + ,118 + ,114 + ,145 + ,99 + ,117 + ,115 + ,138 + ,98 + ,113 + ,119 + ,148 + ,97 + ,106 + ,108 + ,152 + ,99 + ,108 + ,110 + ,169 + ,100 + ,122 + ,120 + ,169 + ,100 + ,115 + ,113 + ,161 + ,100 + ,110 + ,111 + ,174 + ,100 + ,120 + ,121 + ,179 + ,99 + ,104 + ,99 + ,191 + ,101 + ,96 + ,104 + ,190 + ,101 + ,121 + ,117 + ,182 + ,101 + ,111 + ,108 + ,175 + ,101 + ,120 + ,122 + ,181 + ,101 + ,114 + ,122 + ,197 + ,100 + ,107 + ,111 + ,194 + ,102 + ,108 + ,111 + ,197 + ,102 + ,127 + ,131 + ,216 + ,102 + ,105 + ,108 + ,221 + ,103 + ,119 + ,118 + ,218 + ,103 + ,121 + ,119 + ,230 + ,102 + ,106 + ,104 + ,227 + ,103 + ,97 + ,105 + ,204 + ,103 + ,119 + ,118 + ,197 + ,103 + ,122 + ,124 + ,199 + ,103 + ,121 + ,123 + ,208 + ,103 + ,106 + ,114 + ,191 + ,101 + ,114 + ,119 + ,202 + ,104 + ,112 + ,116 + ,211 + ,104 + ,127 + ,129 + ,224 + ,104 + ,109 + ,112 + ,224 + ,104 + ,118 + ,123 + ,231 + ,104 + ,123 + ,124 + ,244 + ,103 + ,115 + ,117 + ,235 + ,105 + ,105 + ,110 + ,250 + ,104 + ,116 + ,118 + ,266 + ,105 + ,131 + ,135 + ,288 + ,106 + ,121 + ,127 + ,283 + ,106 + ,104 + ,117 + ,295 + ,105 + ,127 + ,137 + ,312 + ,107 + ,126 + ,130 + ,334 + ,108 + ,124 + ,132 + ,348 + ,108 + ,132 + ,142 + ,383 + ,109 + ,117 + ,122 + ,407 + ,110 + ,123 + ,126) + ,dim=c(4 + ,60) + ,dimnames=list(c('igrondst' + ,'iconsum' + ,'uitvoer' + ,'invoer') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('igrondst','iconsum','uitvoer','invoer'),1:60)) > 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 = 'ALL' > par1 = 'complete' > ylab = 'height' > xlab = 'cases' > main = 'Dendrogram' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > 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) > d <- as.dendrogram(hc) > str(d) --[dendrogram w/ 2 branches and 60 members at h = 309] |--[dendrogram w/ 2 branches and 9 members at h = 142] | |--[dendrogram w/ 2 branches and 5 members at h = 46.6] | | |--[dendrogram w/ 2 branches and 3 members at h = 24.7] | | | |--leaf "56" | | | `--[dendrogram w/ 2 branches and 2 members at h = 13.6] | | | |--leaf "53" | | | `--leaf "55" | | `--[dendrogram w/ 2 branches and 2 members at h = 36.6] | | |--leaf "52" | | `--leaf "54" | `--[dendrogram w/ 2 branches and 4 members at h = 73.3] | |--[dendrogram w/ 2 branches and 2 members at h = 19.0] | | |--leaf "57" | | `--leaf "58" | `--[dendrogram w/ 2 branches and 2 members at h = 25.1] | |--leaf "59" | `--leaf "60" `--[dendrogram w/ 2 branches and 51 members at h = 153] |--[dendrogram w/ 2 branches and 20 members at h = 66.2] | |--[dendrogram w/ 2 branches and 12 members at h = 40.3] | | |--[dendrogram w/ 2 branches and 2 members at h = 5.29] | | | |--leaf "9" | | | `--leaf "12" | | `--[dendrogram w/ 2 branches and 10 members at h = 30.0] | | |--[dendrogram w/ 2 branches and 6 members at h = 17.4] | | | |--[dendrogram w/ 2 branches and 3 members at h = 9.06] | | | | |--leaf "18" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.47] | | | | |--leaf "15" | | | | `--leaf "17" | | | `--[dendrogram w/ 2 branches and 3 members at h = 14.5] | | | |--leaf "16" | | | `--[dendrogram w/ 2 branches and 2 members at h = 5.29] | | | |--leaf "19" | | | `--leaf "20" | | `--[dendrogram w/ 2 branches and 4 members at h = 24.8] | | |--leaf "14" | | `--[dendrogram w/ 2 branches and 3 members at h = 12.8] | | |--leaf "10" | | `--[dendrogram w/ 2 branches and 2 members at h = 4.24] | | |--leaf "11" | | `--leaf "13" | `--[dendrogram w/ 2 branches and 8 members at h = 45.6] | |--leaf "2" | `--[dendrogram w/ 2 branches and 7 members at h = 22.2] | |--[dendrogram w/ 2 branches and 2 members at h = 10.8] | | |--leaf "3" | | `--leaf "4" | `--[dendrogram w/ 2 branches and 5 members at h = 19.1] | |--[dendrogram w/ 2 branches and 2 members at h = 6.86] | | |--leaf "1" | | `--leaf "5" | `--[dendrogram w/ 2 branches and 3 members at h = 8.83] | |--leaf "6" | `--[dendrogram w/ 2 branches and 2 members at h = 5.29] | |--leaf "7" | `--leaf "8" `--[dendrogram w/ 2 branches and 31 members at h = 89.6] |--[dendrogram w/ 2 branches and 13 members at h = 37.6] | |--[dendrogram w/ 2 branches and 5 members at h = 20.4] | | |--[dendrogram w/ 2 branches and 3 members at h = 6.71] | | | |--leaf "21" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.73] | | | |--leaf "24" | | | `--leaf "29" | | `--[dendrogram w/ 2 branches and 2 members at h = 9.64] | | |--leaf "22" | | `--leaf "23" | `--[dendrogram w/ 2 branches and 8 members at h = 28.2] | |--[dendrogram w/ 2 branches and 3 members at h = 12.4] | | |--leaf "30" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.35] | | |--leaf "27" | | `--leaf "43" | `--[dendrogram w/ 2 branches and 5 members at h = 21.9] | |--[dendrogram w/ 2 branches and 2 members at h = 12.0] | | |--leaf "25" | | `--leaf "28" | `--[dendrogram w/ 2 branches and 3 members at h = 14.4] | |--leaf "26" | `--[dendrogram w/ 2 branches and 2 members at h = 3.74] | |--leaf "31" | `--leaf "32" `--[dendrogram w/ 2 branches and 18 members at h = 55.7] |--[dendrogram w/ 2 branches and 7 members at h = 29.2] | |--[dendrogram w/ 2 branches and 3 members at h = 14.2] | | |--leaf "42" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.62] | | |--leaf "39" | | `--leaf "44" | `--[dendrogram w/ 2 branches and 4 members at h = 15.7] | |--leaf "45" | `--[dendrogram w/ 2 branches and 3 members at h = 10.2] | |--leaf "33" | `--[dendrogram w/ 2 branches and 2 members at h = 2.45] | |--leaf "40" | `--leaf "41" `--[dendrogram w/ 2 branches and 11 members at h = 37.2] |--[dendrogram w/ 2 branches and 5 members at h = 19.3] | |--[dendrogram w/ 2 branches and 2 members at h = 10] | | |--leaf "34" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 3 members at h = 12.5] | |--leaf "38" | `--[dendrogram w/ 2 branches and 2 members at h = 8.43] | |--leaf "37" | `--leaf "50" `--[dendrogram w/ 2 branches and 6 members at h = 32.4] |--[dendrogram w/ 2 branches and 2 members at h = 6.24] | |--leaf "49" | `--leaf "51" `--[dendrogram w/ 2 branches and 4 members at h = 14.1] |--leaf "48" `--[dendrogram w/ 2 branches and 3 members at h = 7.87] |--leaf "47" `--[dendrogram w/ 2 branches and 2 members at h = 3.74] |--leaf "35" `--leaf "36" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/16vth1226354576.ps",horizontal=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/www/html/freestat/rcomp/tmp/2htx91226354576.ps",horizontal=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) + } > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/www/html/freestat/rcomp/tmp/3lvlw1226354576.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/www/html/freestat/rcomp/tmp/447t71226354576.tab") + } > > system("convert tmp/16vth1226354576.ps tmp/16vth1226354576.png") > system("convert tmp/2htx91226354576.ps tmp/2htx91226354576.png") convert: unable to open image `tmp/2htx91226354576.ps': No such file or directory. convert: missing an image filename `tmp/2htx91226354576.png'. > > > proc.time() user system elapsed 0.852 0.283 0.934