R version 2.7.0 (2008-04-22) 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(5.6 + ,8.9 + ,3.4 + ,11 + ,5.6 + ,8.9 + ,3 + ,5 + ,5.5 + ,8.5 + ,3.1 + ,6 + ,5.4 + ,8.1 + ,2.5 + ,2 + ,5.4 + ,7.5 + ,2.2 + ,7 + ,5.4 + ,7.1 + ,2.3 + ,18 + ,5.5 + ,6.9 + ,2.1 + ,19 + ,5.7 + ,7.1 + ,2.8 + ,25 + ,5.7 + ,7 + ,3.1 + ,28 + ,5.4 + ,6.7 + ,2.9 + ,26 + ,5.6 + ,7 + ,2.6 + ,27 + ,5.8 + ,7.3 + ,2.7 + ,35 + ,6.1 + ,7.7 + ,2.3 + ,43 + ,6.8 + ,8.4 + ,2.3 + ,63 + ,6.7 + ,8.4 + ,2.1 + ,80 + ,6.7 + ,8.8 + ,2.2 + ,56 + ,6.4 + ,9.1 + ,2.9 + ,48 + ,6.3 + ,9 + ,2.6 + ,43 + ,6.3 + ,8.6 + ,2.7 + ,43 + ,6.4 + ,7.9 + ,1.8 + ,42 + ,6.3 + ,7.7 + ,1.3 + ,42 + ,6 + ,7.8 + ,0.9 + ,44 + ,6.2 + ,9.1 + ,1.3 + ,52 + ,6.3 + ,9.4 + ,1.3 + ,47 + ,6.6 + ,9.3 + ,1.3 + ,47 + ,7.5 + ,8.7 + ,1.3 + ,47 + ,7.8 + ,8.4 + ,1.1 + ,49 + ,7.9 + ,8.6 + ,1.4 + ,58 + ,7.8 + ,9 + ,1.2 + ,60 + ,7.6 + ,9.1 + ,1.7 + ,65 + ,7.5 + ,8.7 + ,1.8 + ,70 + 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10 + ,1.6 + ,36 + ,6.7 + ,9.9 + ,1.2 + ,37 + ,6.9 + ,9.3 + ,1.2 + ,31 + ,7 + ,9 + ,1.5 + ,32 + ,7.1 + ,9 + ,1.6 + ,59 + ,7.2 + ,9.1 + ,1.7 + ,39 + ,7.1 + ,9.1 + ,1.8 + ,34 + ,6.9 + ,9.1 + ,1.8 + ,35 + ,7 + ,9.2 + ,1.8 + ,27 + ,6.8 + ,8.8 + ,1.3 + ,32 + ,6.4 + ,8.3 + ,1.3 + ,32 + ,6.7 + ,8.4 + ,1.4 + ,34 + ,6.7 + ,8.1 + ,1.1 + ,29 + ,6.4 + ,7.8 + ,1.5 + ,28 + ,6.3 + ,7.9 + ,2.2 + ,24 + ,6.2 + ,7.9 + ,2.9 + ,27 + ,6.5 + ,8 + ,3.1 + ,23 + ,6.8 + ,7.9 + ,3.5 + ,25 + ,6.8 + ,7.5 + ,3.6 + ,20 + ,6.5 + ,7.2 + ,4.4 + ,18 + ,6.3 + ,6.9 + ,4.2 + ,26 + ,5.9 + ,6.6 + ,5.2 + ,31 + ,5.9 + ,6.7 + ,5.8 + ,29) + ,dim=c(4 + ,94) + ,dimnames=list(c('werkloze_mannen' + ,'werkloze_vrouwen' + ,'procentuele_verandering_consprijs' + ,'indicator_consvertrouwen') + ,1:94)) > y <- array(NA,dim=c(4,94),dimnames=list(c('werkloze_mannen','werkloze_vrouwen','procentuele_verandering_consprijs','indicator_consvertrouwen'),1:94)) > 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 = '2' > par1 = 'centroid' > 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 94 members at h = 25.1] |--[dendrogram w/ 2 branches and 2 members at h = 3.34] | |--leaf "15" | `--leaf "38" `--[dendrogram w/ 2 branches and 92 members at h = 19.2] |--[dendrogram w/ 2 branches and 58 members at h = 8.3] | |--[dendrogram w/ 2 branches and 29 members at h = 4.43] | | |--[dendrogram w/ 2 branches and 10 members at h = 1.97] | | | |--leaf "49" | | | `--[dendrogram w/ 2 branches and 9 members at h = 1.72] | | | |--leaf "43" | | | `--[dendrogram w/ 2 branches and 8 members at h = 1.58] | | | |--leaf "23" | | | `--[dendrogram w/ 2 branches and 7 members at h = 1.18] | | | |--leaf "47" | | | `--[dendrogram w/ 2 branches and 6 members at h = 1.25] | | | |--leaf "67" | | | `--[dendrogram w/ 2 branches and 5 members at h = 1.22] | | | |--[dendrogram w/ 2 branches and 3 members at h = 0.926] | | | | |--leaf "64" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.583] | | | | |--leaf "55" | | | | `--leaf "56" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.07] | | | |--leaf "41" | | | `--leaf "42" | | `--[dendrogram w/ 2 branches and 19 members at h = 2.72] | | |--[dendrogram w/ 2 branches and 11 members at h = 1.61] | | | |--[dendrogram w/ 2 branches and 5 members at h = 1.28] | | | | |--leaf "71" | | | | `--[dendrogram w/ 2 branches and 4 members at h = 0.95] | | | | |--leaf "68" | | | | `--[dendrogram w/ 2 branches and 3 members at h = 1.06] | | | | |--leaf "70" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.224] | | | | |--leaf "65" | | | | `--leaf "66" | | | `--[dendrogram w/ 2 branches and 6 members at h = 1.59] | | | |--leaf "22" | | | `--[dendrogram w/ 2 branches and 5 members at h = 1.20] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.548] | | | | |--leaf "20" | | | | `--leaf "21" | | | `--[dendrogram w/ 2 branches and 3 members at h = 1.07] | | | |--leaf "13" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.412] | | | |--leaf "18" | | | `--leaf "19" | | `--[dendrogram w/ 2 branches and 8 members at h = 1.97] | | |--leaf "48" | | `--[dendrogram w/ 2 branches and 7 members at h = 1.59] | | |--leaf "27" | | `--[dendrogram w/ 2 branches and 6 members at h = 1.09] | | |--[dendrogram w/ 2 branches and 3 members at h = 1.16] | | | |--leaf "26" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.316] | | | |--leaf "24" | | | `--leaf "25" | | `--[dendrogram w/ 2 branches and 3 members at h = 1.31] | | |--leaf "69" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.872] | | |--leaf "17" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 29 members at h = 7.71] | |--[dendrogram w/ 2 branches and 2 members at h = 1.12] | | |--leaf "31" | | `--leaf "35" | `--[dendrogram w/ 2 branches and 27 members at h = 3.83] | |--[dendrogram w/ 2 branches and 10 members at h = 1.71] | | |--leaf "59" | | `--[dendrogram w/ 2 branches and 9 members at h = 1.48] | | |--leaf "30" | | `--[dendrogram w/ 2 branches and 8 members at h = 1.24] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.574] | | | |--leaf "36" | | | `--leaf "39" | | `--[dendrogram w/ 2 branches and 6 members at h = 1] | | |--[dendrogram w/ 2 branches and 3 members at h = 0.968] | | | |--leaf "32" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.632] | | | |--leaf "33" | | | `--leaf "34" | | `--[dendrogram w/ 2 branches and 3 members at h = 1.02] | | |--leaf "57" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.9] | | |--leaf "14" | | `--leaf "58" | `--[dendrogram w/ 2 branches and 17 members at h = 2.16] | |--leaf "62" | `--[dendrogram w/ 2 branches and 16 members at h = 1.29] | |--leaf "45" | `--[dendrogram w/ 2 branches and 15 members at h = 1.24] | |--[dendrogram w/ 2 branches and 12 members at h = 1.02] | | |--[dendrogram w/ 2 branches and 6 members at h = 0.852] | | | |--leaf "60" | | | `--[dendrogram w/ 2 branches and 5 members at h = 0.955] | | | |--leaf "61" | | | `--[dendrogram w/ 2 branches and 4 members at h = 0.852] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.447] | | | | |--leaf "54" | | | | `--leaf "63" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.469] | | | |--leaf "51" | | | `--leaf "53" | | `--[dendrogram w/ 2 branches and 6 members at h = 1.17] | | |--leaf "50" | | `--[dendrogram w/ 2 branches and 5 members at h = 1.13] | | |--leaf "28" | | `--[dendrogram w/ 2 branches and 4 members at h = 1.03] | | |--leaf "29" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.769] | | |--leaf "76" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.787] | | |--leaf "40" | | `--leaf "52" | `--[dendrogram w/ 2 branches and 3 members at h = 1.19] | |--leaf "37" | `--[dendrogram w/ 2 branches and 2 members at h = 1.16] | |--leaf "16" | `--leaf "44" `--[dendrogram w/ 2 branches and 34 members at h = 17.3] |--[dendrogram w/ 2 branches and 5 members at h = 5.03] | |--leaf "1" | `--[dendrogram w/ 2 branches and 4 members at h = 3.49] | |--leaf "4" | `--[dendrogram w/ 2 branches and 3 members at h = 1.86] | |--leaf "5" | `--[dendrogram w/ 2 branches and 2 members at h = 1.09] | |--leaf "2" | `--leaf "3" `--[dendrogram w/ 2 branches and 29 members at h = 7.94] |--[dendrogram w/ 2 branches and 4 members at h = 1.74] | |--[dendrogram w/ 2 branches and 2 members at h = 1.04] | | |--leaf "6" | | `--leaf "7" | `--[dendrogram w/ 2 branches and 2 members at h = 2.20] | |--leaf "90" | `--leaf "91" `--[dendrogram w/ 2 branches and 25 members at h = 5.04] |--[dendrogram w/ 2 branches and 14 members at h = 3.38] | |--[dendrogram w/ 2 branches and 2 members at h = 2.09] | | |--leaf "93" | | `--leaf "94" | `--[dendrogram w/ 2 branches and 12 members at h = 2.18] | |--[dendrogram w/ 2 branches and 2 members at h = 1.36] | | |--leaf "86" | | `--leaf "88" | `--[dendrogram w/ 2 branches and 10 members at h = 1.71] | |--[dendrogram w/ 2 branches and 7 members at h = 1.51] | | |--leaf "89" | | `--[dendrogram w/ 2 branches and 6 members at h = 1.38] | | |--leaf "8" | | `--[dendrogram w/ 2 branches and 5 members at h = 1.44] | | |--leaf "92" | | `--[dendrogram w/ 2 branches and 4 members at h = 1.1] | | |--leaf "9" | | `--[dendrogram w/ 2 branches and 3 members at h = 1.16] | | |--leaf "87" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.10] | | |--leaf "10" | | `--leaf "11" | `--[dendrogram w/ 2 branches and 3 members at h = 1.84] | |--leaf "80" | `--[dendrogram w/ 2 branches and 2 members at h = 1.16] | |--leaf "84" | `--leaf "85" `--[dendrogram w/ 2 branches and 11 members at h = 4.08] |--leaf "77" `--[dendrogram w/ 2 branches and 10 members at h = 2.36] |--[dendrogram w/ 2 branches and 4 members at h = 1.03] | |--leaf "74" | `--[dendrogram w/ 2 branches and 3 members at h = 0.705] | |--leaf "82" | `--[dendrogram w/ 2 branches and 2 members at h = 0.346] | |--leaf "75" | `--leaf "81" `--[dendrogram w/ 2 branches and 6 members at h = 2.02] |--leaf "12" `--[dendrogram w/ 2 branches and 5 members at h = 1.87] |--[dendrogram w/ 2 branches and 3 members at h = 0.935] | |--leaf "79" | `--[dendrogram w/ 2 branches and 2 members at h = 0.9] | |--leaf "78" | `--leaf "83" `--[dendrogram w/ 2 branches and 2 members at h = 1.09] |--leaf "72" `--leaf "73" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1zrnp1226341872.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/2dkob1226341872.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) + } --[dendrogram w/ 2 branches and 2 members at h = 35.1] |--leaf 1 `--leaf 2 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > 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/3qe1d1226341872.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/404yv1226341872.tab") + } > > system("convert tmp/1zrnp1226341872.ps tmp/1zrnp1226341872.png") > system("convert tmp/2dkob1226341872.ps tmp/2dkob1226341872.png") > > > proc.time() user system elapsed 2.018 0.510 2.117