R version 2.6.0 (2007-10-03) Copyright (C) 2007 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. Natural language support but running in an English locale 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(513 + ,140 + ,373 + ,96 + ,87 + ,503 + ,132 + ,371 + ,86 + ,75 + ,471 + ,117 + ,354 + ,82 + ,74 + ,471 + ,114 + ,357 + ,92 + ,91 + ,476 + ,113 + ,363 + ,99 + ,101 + ,475 + ,110 + ,364 + ,101 + ,103 + ,470 + ,107 + ,363 + ,102 + ,106 + ,461 + ,103 + ,358 + ,100 + ,102 + ,455 + ,98 + ,357 + ,101 + ,105 + ,456 + ,98 + ,357 + ,100 + ,105 + ,517 + ,137 + ,380 + ,99 + ,100 + ,525 + ,148 + ,378 + ,97 + ,95 + ,523 + ,147 + ,376 + ,97 + ,96 + ,519 + ,139 + ,380 + ,97 + ,98 + ,509 + ,130 + ,379 + ,96 + ,99 + ,512 + ,128 + ,384 + ,92 + ,92 + ,519 + ,127 + ,392 + ,91 + ,84 + ,517 + ,123 + ,394 + ,87 + ,81 + ,510 + ,118 + ,392 + ,82 + ,72 + ,509 + ,114 + ,396 + ,89 + ,89 + ,501 + ,108 + ,392 + ,91 + ,96 + ,507 + ,111 + ,396 + ,90 + ,91 + ,569 + ,151 + ,419 + ,87 + ,88 + ,580 + ,159 + ,421 + ,89 + ,90 + ,578 + ,158 + ,420 + ,95 + ,98 + ,565 + ,148 + ,418 + ,85 + ,87 + ,547 + ,138 + ,410 + ,94 + ,100 + ,555 + ,137 + ,418 + ,94 + ,100 + ,562 + ,136 + ,426 + ,97 + ,104 + ,561 + ,133 + ,428 + ,99 + ,107 + ,555 + ,126 + ,430 + ,97 + ,105 + ,544 + ,120 + ,424 + ,96 + ,102 + ,537 + ,114 + ,423 + ,94 + ,98 + ,543 + ,116 + ,427 + ,100 + ,106 + ,594 + ,153 + ,441 + ,96 + ,97 + ,611 + ,162 + ,449 + ,98 + ,101 + ,613 + ,161 + ,452 + ,98 + ,100 + ,611 + ,149 + ,462 + ,94 + ,93 + ,594 + ,139 + ,455 + ,93 + ,94 + ,595 + ,135 + ,461 + ,94 + ,96 + ,591 + ,130 + ,461 + ,94 + ,96 + ,589 + ,127 + ,463 + ,97 + ,98 + ,584 + ,122 + ,462 + ,98 + ,102 + ,573 + ,117 + ,456 + ,95 + ,95 + ,567 + ,112 + ,455 + ,89 + ,85 + ,569 + ,113 + ,456 + ,89 + ,84 + ,621 + ,149 + ,472 + ,89 + ,82 + ,629 + ,157 + ,472 + ,90 + ,87 + ,628 + ,157 + ,471 + ,86 + ,77 + ,612 + ,147 + ,465 + ,92 + ,90 + ,595 + ,137 + ,459 + ,91 + ,90 + ,597 + ,132 + ,465 + ,95 + ,94 + ,593 + ,125 + ,468 + ,99 + ,97 + ,590 + ,123 + ,467 + ,98 + ,96 + ,580 + ,117 + ,463 + ,95 + ,93 + ,574 + ,114 + ,460 + ,96 + ,93 + ,573 + ,111 + ,462 + ,94 + ,93 + ,573 + ,112 + ,461 + ,98 + ,97 + ,620 + ,144 + ,476 + ,98 + ,100 + ,626 + ,150 + ,476 + ,98 + ,95 + ,620 + ,149 + ,471 + ,98 + ,97 + ,588 + ,134 + ,453 + ,102 + ,103 + ,566 + ,123 + ,443 + ,101 + ,102 + ,557 + ,116 + ,442 + ,92 + ,93 + ,561 + ,117 + ,444 + ,99 + ,99 + ,549 + ,111 + ,438 + ,101 + ,100 + ,532 + ,105 + ,427 + ,99 + ,97 + ,526 + ,102 + ,424 + ,102 + ,104 + ,511 + ,95 + ,416 + ,102 + ,102 + ,499 + ,93 + ,406 + ,101 + ,103 + ,555 + ,124 + ,431 + ,99 + ,100 + ,565 + ,130 + ,434 + ,98 + ,90 + ,542 + ,124 + ,418 + ,98 + ,90) + ,dim=c(5 + ,73) + ,dimnames=list(c('Totaal' + ,'-25' + ,'25' + ,'CV' + ,'Algemeen ') + ,1:73)) > y <- array(NA,dim=c(5,73),dimnames=list(c('Totaal','-25','25','CV','Algemeen '),1:73)) > 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 = 'ward' > 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: Wessa, P., (2007), Hierarchical Clustering (v1.0.1) 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 > #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 73 members at h = 2163] |--[dendrogram w/ 2 branches and 24 members at h = 410] | |--[dendrogram w/ 2 branches and 8 members at h = 58.3] | | |--[dendrogram w/ 2 branches and 3 members at h = 10.3] | | | |--leaf "8" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.41] | | | |--leaf "9" | | | `--leaf "10" | | `--[dendrogram w/ 2 branches and 5 members at h = 47.4] | | |--[dendrogram w/ 2 branches and 3 members at h = 9.88] | | | |--leaf "7" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.36] | | | |--leaf "5" | | | `--leaf "6" | | `--[dendrogram w/ 2 branches and 2 members at h = 20.2] | | |--leaf "3" | | `--leaf "4" | `--[dendrogram w/ 2 branches and 16 members at h = 146] | |--[dendrogram w/ 2 branches and 7 members at h = 33.3] | | |--[dendrogram w/ 2 branches and 2 members at h = 3.16] | | | |--leaf "12" | | | `--leaf "13" | | `--[dendrogram w/ 2 branches and 5 members at h = 21.0] | | |--[dendrogram w/ 2 branches and 2 members at h = 10.1] | | | |--leaf "15" | | | `--leaf "16" | | `--[dendrogram w/ 2 branches and 3 members at h = 18.9] | | |--leaf "1" | | `--[dendrogram w/ 2 branches and 2 members at h = 4] | | |--leaf "11" | | `--leaf "14" | `--[dendrogram w/ 2 branches and 9 members at h = 88.6] | |--[dendrogram w/ 2 branches and 2 members at h = 15.8] | | |--leaf "69" | | `--leaf "70" | `--[dendrogram w/ 2 branches and 7 members at h = 51.5] | |--[dendrogram w/ 2 branches and 3 members at h = 13.5] | | |--leaf "21" | | `--[dendrogram w/ 2 branches and 2 members at h = 4.24] | | |--leaf "20" | | `--leaf "22" | `--[dendrogram w/ 2 branches and 4 members at h = 35.5] | |--leaf "2" | `--[dendrogram w/ 2 branches and 3 members at h = 19.8] | |--leaf "19" | `--[dendrogram w/ 2 branches and 2 members at h = 7] | |--leaf "17" | `--leaf "18" `--[dendrogram w/ 2 branches and 49 members at h = 742] |--[dendrogram w/ 2 branches and 21 members at h = 180] | |--[dendrogram w/ 2 branches and 4 members at h = 28.5] | | |--[dendrogram w/ 2 branches and 2 members at h = 5.57] | | | |--leaf "23" | | | `--leaf "26" | | `--[dendrogram w/ 2 branches and 2 members at h = 10.3] | | |--leaf "24" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 17 members at h = 105] | |--[dendrogram w/ 2 branches and 6 members at h = 37.6] | | |--[dendrogram w/ 2 branches and 2 members at h = 10.6] | | | |--leaf "67" | | | `--leaf "68" | | `--[dendrogram w/ 2 branches and 4 members at h = 19.7] | | |--leaf "73" | | `--[dendrogram w/ 2 branches and 3 members at h = 12.7] | | |--leaf "33" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.62] | | |--leaf "32" | | `--leaf "34" | `--[dendrogram w/ 2 branches and 11 members at h = 66.8] | |--[dendrogram w/ 2 branches and 4 members at h = 19.9] | | |--[dendrogram w/ 2 branches and 2 members at h = 8.66] | | | |--leaf "63" | | | `--leaf "65" | | `--[dendrogram w/ 2 branches and 2 members at h = 15.3] | | |--leaf "64" | | `--leaf "66" | `--[dendrogram w/ 2 branches and 7 members at h = 39.1] | |--[dendrogram w/ 2 branches and 2 members at h = 11.4] | | |--leaf "27" | | `--leaf "28" | `--[dendrogram w/ 2 branches and 5 members at h = 22.1] | |--leaf "72" | `--[dendrogram w/ 2 branches and 4 members at h = 20.2] | |--[dendrogram w/ 2 branches and 2 members at h = 5.2] | | |--leaf "29" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 2 members at h = 5.83] | |--leaf "31" | `--leaf "71" `--[dendrogram w/ 2 branches and 28 members at h = 365] |--[dendrogram w/ 2 branches and 11 members at h = 89.2] | |--[dendrogram w/ 2 branches and 3 members at h = 28.7] | | |--leaf "35" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.87] | | |--leaf "36" | | `--leaf "37" | `--[dendrogram w/ 2 branches and 8 members at h = 44.5] | |--[dendrogram w/ 2 branches and 3 members at h = 12.8] | | |--leaf "47" | | `--[dendrogram w/ 2 branches and 2 members at h = 10.9] | | |--leaf "48" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 5 members at h = 32.3] | |--[dendrogram w/ 2 branches and 2 members at h = 5.2] | | |--leaf "38" | | `--leaf "50" | `--[dendrogram w/ 2 branches and 3 members at h = 9.42] | |--leaf "60" | `--[dendrogram w/ 2 branches and 2 members at h = 7.68] | |--leaf "59" | `--leaf "61" `--[dendrogram w/ 2 branches and 17 members at h = 142] |--[dendrogram w/ 2 branches and 7 members at h = 32.8] | |--[dendrogram w/ 2 branches and 2 members at h = 2.65] | | |--leaf "45" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 5 members at h = 11.1] | |--leaf "55" | `--[dendrogram w/ 2 branches and 4 members at h = 8.61] | |--leaf "44" | `--[dendrogram w/ 2 branches and 3 members at h = 5.87] | |--leaf "58" | `--[dendrogram w/ 2 branches and 2 members at h = 4.24] | |--leaf "56" | `--leaf "57" `--[dendrogram w/ 2 branches and 10 members at h = 36.8] |--[dendrogram w/ 2 branches and 4 members at h = 12.6] | |--[dendrogram w/ 2 branches and 2 members at h = 5.83] | | |--leaf "40" | | `--leaf "52" | `--[dendrogram w/ 2 branches and 2 members at h = 6.4] | |--leaf "39" | `--leaf "51" `--[dendrogram w/ 2 branches and 6 members at h = 22.1] |--leaf "62" `--[dendrogram w/ 2 branches and 5 members at h = 13.0] |--leaf "43" `--[dendrogram w/ 2 branches and 4 members at h = 12.0] |--[dendrogram w/ 2 branches and 2 members at h = 4] | |--leaf "53" | `--leaf "54" `--[dendrogram w/ 2 branches and 2 members at h = 5.48] |--leaf "41" `--leaf "42" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1bawi1194893335.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/rcomp/tmp/2ty0q1194893336.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) + } > load(file='/var/www/html/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/rcomp/tmp/353641194893336.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/rcomp/tmp/4jwss1194893336.tab") + } > > system("convert tmp/1bawi1194893335.ps tmp/1bawi1194893335.png") > system("convert tmp/2ty0q1194893336.ps tmp/2ty0q1194893336.png") convert: unable to open image `tmp/2ty0q1194893336.ps': No such file or directory. convert: missing an image filename `tmp/2ty0q1194893336.png'. > > > proc.time() user system elapsed 1.784 0.314 1.935