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. 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,503,471,471,476,475,470,461,455,456,517,525,523,519,509,512,519,517,510,509,501,507,569,580,578,565,547,555,562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565),dim=c(1,72),dimnames=list(c('WerkloosheidBelgië'),1:72)) > y <- array(NA,dim=c(1,72),dimnames=list(c('WerkloosheidBelgië'),1:72)) > 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 72 members at h = 1804] |--[dendrogram w/ 2 branches and 25 members at h = 406] | |--[dendrogram w/ 2 branches and 8 members at h = 47.5] | | |--[dendrogram w/ 2 branches and 3 members at h = 7] | | | |--leaf "8" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1] | | | |--leaf "9" | | | `--leaf "10" | | `--[dendrogram w/ 2 branches and 5 members at h = 10.5] | | |--[dendrogram w/ 2 branches and 2 members at h = 1] | | | |--leaf "5" | | | `--leaf "6" | | `--[dendrogram w/ 2 branches and 3 members at h = 1.33] | | |--leaf "7" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "3" | | `--leaf "4" | `--[dendrogram w/ 2 branches and 17 members at h = 74.3] | |--[dendrogram w/ 2 branches and 7 members at h = 18.9] | | |--[dendrogram w/ 2 branches and 3 members at h = 3] | | | |--leaf "13" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1] | | | |--leaf "12" | | | `--leaf "68" | | `--[dendrogram w/ 2 branches and 4 members at h = 4] | | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | | |--leaf "11" | | | `--leaf "18" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "14" | | `--leaf "17" | `--[dendrogram w/ 2 branches and 10 members at h = 30.2] | |--[dendrogram w/ 2 branches and 3 members at h = 3.33] | | |--leaf "70" | | `--[dendrogram w/ 2 branches and 2 members at h = 2] | | |--leaf "2" | | `--leaf "21" | `--[dendrogram w/ 2 branches and 7 members at h = 6.66] | |--[dendrogram w/ 2 branches and 2 members at h = 1] | | |--leaf "1" | | `--leaf "16" | `--[dendrogram w/ 2 branches and 5 members at h = 3.7] | |--leaf "22" | `--[dendrogram w/ 2 branches and 4 members at h = 2.5] | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "15" | | `--leaf "20" | `--[dendrogram w/ 2 branches and 2 members at h = 1] | |--leaf "19" | `--leaf "69" `--[dendrogram w/ 2 branches and 47 members at h = 651] |--[dendrogram w/ 2 branches and 27 members at h = 164] | |--[dendrogram w/ 2 branches and 6 members at h = 23.2] | | |--[dendrogram w/ 2 branches and 2 members at h = 5] | | | |--leaf "33" | | | `--leaf "67" | | `--[dendrogram w/ 2 branches and 4 members at h = 7.5] | | |--[dendrogram w/ 2 branches and 2 members at h = 1] | | | |--leaf "32" | | | `--leaf "34" | | `--[dendrogram w/ 2 branches and 2 members at h = 2] | | |--leaf "27" | | `--leaf "66" | `--[dendrogram w/ 2 branches and 21 members at h = 97.1] | |--[dendrogram w/ 2 branches and 8 members at h = 23.8] | | |--[dendrogram w/ 2 branches and 4 members at h = 1.5] | | | |--leaf "56" | | | `--[dendrogram w/ 2 branches and 3 members at h = 0] | | | |--leaf "58" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | | |--leaf "44" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 4 members at h = 6.33] | | |--leaf "43" | | `--[dendrogram w/ 2 branches and 3 members at h = 2.67] | | |--leaf "25" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "24" | | `--leaf "55" | `--[dendrogram w/ 2 branches and 13 members at h = 41.4] | |--[dendrogram w/ 2 branches and 4 members at h = 3] | | |--leaf "64" | | `--[dendrogram w/ 2 branches and 3 members at h = 0] | | |--leaf "71" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "28" | | `--leaf "31" | `--[dendrogram w/ 2 branches and 9 members at h = 17.4] | |--[dendrogram w/ 2 branches and 3 members at h = 1.33] | | |--leaf "29" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "30" | | `--leaf "65" | `--[dendrogram w/ 2 branches and 6 members at h = 7.5] | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "23" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 4 members at h = 2.5] | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "26" | | `--leaf "72" | `--[dendrogram w/ 2 branches and 2 members at h = 1] | |--leaf "45" | `--leaf "63" `--[dendrogram w/ 2 branches and 20 members at h = 212] |--[dendrogram w/ 2 branches and 10 members at h = 18.6] | |--[dendrogram w/ 2 branches and 4 members at h = 3] | | |--[dendrogram w/ 2 branches and 2 members at h = 1] | | | |--leaf "41" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 2 members at h = 1] | | |--leaf "42" | | `--leaf "62" | `--[dendrogram w/ 2 branches and 6 members at h = 4] | |--[dendrogram w/ 2 branches and 3 members at h = 1.33] | | |--leaf "53" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "35" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 3 members at h = 2.67] | |--leaf "52" | `--[dendrogram w/ 2 branches and 2 members at h = 0] | |--leaf "40" | `--leaf "51" `--[dendrogram w/ 2 branches and 10 members at h = 46.8] |--[dendrogram w/ 2 branches and 4 members at h = 2.5] | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "36" | | `--leaf "38" | `--[dendrogram w/ 2 branches and 2 members at h = 1] | |--leaf "37" | `--leaf "50" `--[dendrogram w/ 2 branches and 6 members at h = 19.3] |--[dendrogram w/ 2 branches and 3 members at h = 1.33] | |--leaf "47" | `--[dendrogram w/ 2 branches and 2 members at h = 0] | |--leaf "59" | `--leaf "61" `--[dendrogram w/ 2 branches and 3 members at h = 3] |--leaf "60" `--[dendrogram w/ 2 branches and 2 members at h = 1] |--leaf "48" `--leaf "49" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1k96r1193910609.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/2q9w21193910609.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/3w25t1193910609.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/44y2k1193910609.tab") + } > > system("convert tmp/1k96r1193910609.ps tmp/1k96r1193910609.png") > system("convert tmp/2q9w21193910609.ps tmp/2q9w21193910609.png") convert: unable to open image `tmp/2q9w21193910609.ps': No such file or directory. convert: missing an image filename `tmp/2q9w21193910609.png'. > > > proc.time() user system elapsed 0.851 0.199 0.947