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(217859 + ,258778 + ,88827 + ,565464 + ,208679 + ,252791 + ,85874 + ,547344 + ,213188 + ,256389 + ,85211 + ,554788 + ,216234 + ,258961 + ,87130 + ,562325 + ,213587 + ,258647 + ,88620 + ,560854 + ,209465 + ,256304 + ,89563 + ,555332 + ,204045 + ,250498 + ,89056 + ,543599 + ,200237 + ,247883 + ,88542 + ,536662 + ,203666 + ,249552 + ,89504 + ,542722 + ,241476 + ,262626 + ,89428 + ,593530 + ,260307 + ,264416 + ,86040 + ,610763 + ,243324 + ,273049 + ,96240 + ,612613 + ,244460 + ,272441 + ,94423 + ,611324 + ,233575 + ,267564 + ,93028 + ,594167 + ,237217 + ,265952 + ,92285 + ,595454 + ,235243 + ,263937 + ,91685 + ,590865 + ,230354 + ,264765 + ,94260 + ,589379 + ,227184 + ,263386 + ,93858 + ,584428 + ,221678 + ,258985 + ,92437 + ,573100 + ,217142 + ,257334 + ,92980 + ,567456 + ,219452 + ,257477 + ,92099 + ,569028 + ,256446 + ,271486 + ,92803 + ,620735 + ,265845 + ,274488 + ,88551 + ,628884 + ,248624 + ,281274 + ,98334 + ,628232 + ,241114 + ,272674 + ,98329 + ,612117 + ,229245 + ,269704 + ,96455 + ,595404 + ,231805 + ,268227 + ,97109 + ,597141 + ,219277 + ,276444 + ,97687 + ,593408 + ,219313 + ,272247 + ,98512 + ,590072 + ,212610 + ,268516 + ,98673 + ,579799 + ,214771 + ,263406 + ,96028 + ,574205 + ,211142 + ,263619 + ,98014 + ,572775 + ,211457 + ,265905 + ,95580 + ,572942 + ,240048 + ,281681 + ,97838 + ,619567 + ,240636 + ,287413 + ,97760 + ,625809 + ,230580 + ,289423 + ,99913 + ,619916 + ,208795 + ,281242 + ,97588 + ,587625 + ,197922 + ,273878 + ,93942 + ,565742 + ,194596 + ,269022 + ,93656 + ,557274 + ,194581 + ,272630 + ,93365 + ,560576 + ,185686 + ,270287 + ,92881 + ,548854 + ,178106 + ,260447 + ,93120 + ,531673 + ,172608 + ,262248 + ,91063 + ,525919 + ,167302 + ,252806 + ,90930 + ,511038 + ,168053 + ,238663 + ,91946 + ,498662 + ,202300 + ,258438 + ,94624 + ,555362 + ,202388 + ,266719 + ,95484 + ,564591 + ,182516 + ,263279 + ,95862 + ,541657 + ,173476 + ,258064 + ,95530 + ,527070 + ,166444 + ,248828 + ,94574 + ,509846 + ,171297 + ,248284 + ,94677 + ,514258 + ,169701 + ,253376 + ,93845 + ,516922 + ,164182 + ,251846 + ,91533 + ,507561 + ,161914 + ,239494 + ,91214 + ,492622 + ,159612 + ,239709 + ,90922 + ,490243 + ,151001 + ,228793 + ,89563 + ,469357 + ,158114 + ,229521 + ,89945 + ,477580 + ,186530 + ,249999 + ,91850 + ,528379 + ,187069 + ,254016 + ,92505 + ,533590 + ,174330 + ,251178 + ,92437 + ,517945) + ,dim=c(4 + ,60) + ,dimnames=list(c('Vlaanderen' + ,'Wallonië' + ,'Brussel' + ,'België') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('Vlaanderen','Wallonië','Brussel','België'),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 = '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: 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 = 1392130] |--[dendrogram w/ 2 branches and 18 members at h = 218048] | |--[dendrogram w/ 2 branches and 5 members at h = 46395] | | |--[dendrogram w/ 2 branches and 2 members at h = 10904] | | | |--leaf "56" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 3 members at h = 12686] | | |--leaf "45" | | `--[dendrogram w/ 2 branches and 2 members at h = 3330] | | |--leaf "54" | | `--leaf "55" | `--[dendrogram w/ 2 branches and 13 members at h = 106696] | |--[dendrogram w/ 2 branches and 6 members at h = 18575] | | |--[dendrogram w/ 2 branches and 3 members at h = 5696] | | | |--leaf "50" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4807] | | | |--leaf "44" | | | `--leaf "53" | | `--[dendrogram w/ 2 branches and 3 members at h = 6221] | | |--leaf "51" | | `--[dendrogram w/ 2 branches and 2 members at h = 5412] | | |--leaf "52" | | `--leaf "60" | `--[dendrogram w/ 2 branches and 7 members at h = 38144] | |--[dendrogram w/ 2 branches and 2 members at h = 10947] | | |--leaf "41" | | `--leaf "48" | `--[dendrogram w/ 2 branches and 5 members at h = 27708] | |--[dendrogram w/ 2 branches and 2 members at h = 6634] | | |--leaf "58" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 3 members at h = 8418] | |--leaf "42" | `--[dendrogram w/ 2 branches and 2 members at h = 6288] | |--leaf "43" | `--leaf "49" `--[dendrogram w/ 2 branches and 42 members at h = 688911] |--[dendrogram w/ 2 branches and 21 members at h = 123789] | |--[dendrogram w/ 2 branches and 7 members at h = 35068] | | |--[dendrogram w/ 2 branches and 4 members at h = 12325] | | | |--leaf "8" | | | `--[dendrogram w/ 2 branches and 3 members at h = 9867] | | | |--leaf "2" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1417] | | | |--leaf "7" | | | `--leaf "9" | | `--[dendrogram w/ 2 branches and 3 members at h = 13800] | | |--leaf "46" | | `--[dendrogram w/ 2 branches and 2 members at h = 5754] | | |--leaf "3" | | `--leaf "6" | `--[dendrogram w/ 2 branches and 14 members at h = 87092] | |--[dendrogram w/ 2 branches and 4 members at h = 12473] | | |--[dendrogram w/ 2 branches and 2 members at h = 4900] | | | |--leaf "39" | | | `--leaf "40" | | `--[dendrogram w/ 2 branches and 2 members at h = 8654] | | |--leaf "38" | | `--leaf "47" | `--[dendrogram w/ 2 branches and 10 members at h = 45726] | |--[dendrogram w/ 2 branches and 4 members at h = 10517] | | |--leaf "30" | | `--[dendrogram w/ 2 branches and 3 members at h = 4710] | | |--leaf "31" | | `--[dendrogram w/ 2 branches and 2 members at h = 3358] | | |--leaf "32" | | `--leaf "33" | `--[dendrogram w/ 2 branches and 6 members at h = 18479] | |--[dendrogram w/ 2 branches and 3 members at h = 5680] | | |--leaf "1" | | `--[dendrogram w/ 2 branches and 2 members at h = 3390] | | |--leaf "4" | | `--leaf "5" | `--[dendrogram w/ 2 branches and 3 members at h = 7247] | |--leaf "19" | `--[dendrogram w/ 2 branches and 2 members at h = 2933] | |--leaf "20" | `--leaf "21" `--[dendrogram w/ 2 branches and 21 members at h = 222251] |--[dendrogram w/ 2 branches and 10 members at h = 61133] | |--[dendrogram w/ 2 branches and 3 members at h = 19571] | | |--leaf "11" | | `--[dendrogram w/ 2 branches and 2 members at h = 13485] | | |--leaf "22" | | `--leaf "23" | `--[dendrogram w/ 2 branches and 7 members at h = 43442] | |--[dendrogram w/ 2 branches and 3 members at h = 4684] | | |--leaf "25" | | `--[dendrogram w/ 2 branches and 2 members at h = 2574] | | |--leaf "12" | | `--leaf "13" | `--[dendrogram w/ 2 branches and 4 members at h = 17802] | |--leaf "36" | `--[dendrogram w/ 2 branches and 3 members at h = 12226] | |--leaf "24" | `--[dendrogram w/ 2 branches and 2 members at h = 8495] | |--leaf "34" | `--leaf "35" `--[dendrogram w/ 2 branches and 11 members at h = 62396] |--[dendrogram w/ 2 branches and 3 members at h = 16180] | |--leaf "37" | `--[dendrogram w/ 2 branches and 2 members at h = 5425] | |--leaf "28" | `--leaf "29" `--[dendrogram w/ 2 branches and 8 members at h = 19205] |--[dendrogram w/ 2 branches and 2 members at h = 6052] | |--leaf "17" | `--leaf "18" `--[dendrogram w/ 2 branches and 6 members at h = 17710] |--[dendrogram w/ 2 branches and 2 members at h = 3490] | |--leaf "26" | `--leaf "27" `--[dendrogram w/ 2 branches and 4 members at h = 9337] |--leaf "10" `--[dendrogram w/ 2 branches and 3 members at h = 5764] |--leaf "16" `--[dendrogram w/ 2 branches and 2 members at h = 4251] |--leaf "14" `--leaf "15" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1tjvt1226141438.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/2u4s61226141438.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/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/3ui541226141438.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/4qjem1226141438.tab") + } > > system("convert tmp/1tjvt1226141438.ps tmp/1tjvt1226141438.png") > system("convert tmp/2u4s61226141438.ps tmp/2u4s61226141438.png") convert: unable to open image `tmp/2u4s61226141438.ps': No such file or directory. convert: missing an image filename `tmp/2u4s61226141438.png'. > > > proc.time() user system elapsed 1.544 0.299 1.616