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(641 + ,12055 + ,2411 + ,550 + ,12113 + ,2361 + ,542 + ,9617 + ,1924 + ,629 + ,12646 + ,2487 + ,687 + ,13581 + ,2675 + ,612 + ,12162 + ,2296 + ,588 + ,10970 + ,2102 + ,567 + ,11880 + ,2322 + ,564 + ,11888 + ,2274 + ,570 + ,12927 + ,2501 + ,635 + ,12300 + ,2435 + ,591 + ,12093 + ,2273 + ,634 + ,12381 + ,2455 + ,576 + ,12197 + ,2329 + ,352 + ,9455 + ,1897 + ,508 + ,13168 + ,2608 + ,586 + ,13428 + ,2712 + ,666 + ,11981 + ,2322 + ,694 + ,11885 + ,2283 + ,651 + ,11692 + ,2241 + ,655 + ,12234 + ,2417 + ,734 + ,14341 + ,2829 + ,648 + ,13131 + ,2601 + ,678 + ,12421 + ,2321 + ,816 + ,14286 + ,2769 + ,591 + ,12865 + ,2457 + ,564 + ,11160 + ,2143 + ,743 + ,14316 + ,2764 + ,694 + ,14389 + ,2789 + ,729 + ,14014 + ,2680 + ,749 + ,13419 + ,2537 + ,539 + ,12770 + ,2683 + ,569 + ,13316 + ,2700 + ,693 + ,15333 + ,3098 + ,581 + ,14243 + ,3015 + ,507 + ,13824 + ,2878 + ,613 + ,14963 + ,3011 + ,443 + ,13203 + ,2612 + ,523 + ,12199 + ,2419 + ,597 + ,15509 + ,3097 + ,534 + ,14200 + ,3013 + ,523 + ,15170 + ,3397 + ,559 + ,14058 + ,3423 + ,431 + ,13786 + ,3299 + ,538 + ,14148 + ,3066 + ,612 + ,16542 + ,3918 + ,428 + ,13588 + ,3154 + ,522 + ,15582 + ,3335 + ,531 + ,15803 + ,3462 + ,426 + ,14131 + ,3019 + ,410 + ,12923 + ,2832 + ,551 + ,15612 + ,3301 + ,556 + ,16034 + ,3343 + ,460 + ,16037 + ,3464 + ,289 + ,14038 + ,3017 + ,392 + ,15331 + ,3201 + ,401 + ,15038 + ,3135 + ,399 + ,17402 + ,3550 + ,355 + ,14993 + ,3247 + ,338 + ,16044 + ,3442 + ,379 + ,16930 + ,3536 + ,334 + ,15921 + ,3385 + ,322 + ,14417 + ,2997 + ,450 + ,15961 + ,3403 + ,486 + ,17852 + ,3900 + ,422 + ,16484 + ,3776 + ,406 + ,14216 + ,3198 + ,420 + ,17430 + ,4022 + ,432 + ,17840 + ,3845 + ,418 + ,17629 + ,3818) + ,dim=c(3 + ,70) + ,dimnames=list(c('Brussels' + ,'Vlaams' + ,'Waals') + ,1:70)) > y <- array(NA,dim=c(3,70),dimnames=list(c('Brussels','Vlaams','Waals'),1:70)) > 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 70 members at h = 65670] |--[dendrogram w/ 2 branches and 23 members at h = 12850] | |--[dendrogram w/ 2 branches and 8 members at h = 2354] | | |--[dendrogram w/ 2 branches and 4 members at h = 498] | | | |--leaf "68" | | | `--[dendrogram w/ 2 branches and 3 members at h = 281] | | | |--leaf "70" | | | `--[dendrogram w/ 2 branches and 2 members at h = 78] | | | |--leaf "65" | | | `--leaf "69" | | `--[dendrogram w/ 2 branches and 4 members at h = 1144] | | |--[dendrogram w/ 2 branches and 2 members at h = 244] | | | |--leaf "46" | | | `--leaf "66" | | `--[dendrogram w/ 2 branches and 2 members at h = 473] | | |--leaf "58" | | `--leaf "61" | `--[dendrogram w/ 2 branches and 15 members at h = 3518] | |--[dendrogram w/ 2 branches and 6 members at h = 308] | | |--leaf "49" | | `--[dendrogram w/ 2 branches and 5 members at h = 243] | | |--[dendrogram w/ 2 branches and 2 members at h = 136] | | | |--leaf "60" | | | `--leaf "62" | | `--[dendrogram w/ 2 branches and 3 members at h = 165] | | |--leaf "53" | | `--[dendrogram w/ 2 branches and 2 members at h = 98] | | |--leaf "54" | | `--leaf "64" | `--[dendrogram w/ 2 branches and 9 members at h = 1149] | |--[dendrogram w/ 2 branches and 3 members at h = 362] | | |--leaf "37" | | `--[dendrogram w/ 2 branches and 2 members at h = 129] | | |--leaf "57" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 6 members at h = 565] | |--[dendrogram w/ 2 branches and 2 members at h = 53.8] | | |--leaf "48" | | `--leaf "52" | `--[dendrogram w/ 2 branches and 4 members at h = 481] | |--[dendrogram w/ 2 branches and 2 members at h = 200] | | |--leaf "34" | | `--leaf "40" | `--[dendrogram w/ 2 branches and 2 members at h = 285] | |--leaf "42" | `--leaf "56" `--[dendrogram w/ 2 branches and 47 members at h = 29033] |--[dendrogram w/ 2 branches and 19 members at h = 8144] | |--[dendrogram w/ 2 branches and 15 members at h = 1449] | | |--[dendrogram w/ 2 branches and 6 members at h = 348] | | | |--leaf "20" | | | `--[dendrogram w/ 2 branches and 5 members at h = 248] | | | |--[dendrogram w/ 2 branches and 2 members at h = 48.8] | | | | |--leaf "8" | | | | `--leaf "9" | | | `--[dendrogram w/ 2 branches and 3 members at h = 189] | | | |--leaf "1" | | | `--[dendrogram w/ 2 branches and 2 members at h = 107] | | | |--leaf "18" | | | `--leaf "19" | | `--[dendrogram w/ 2 branches and 9 members at h = 597] | | |--[dendrogram w/ 2 branches and 5 members at h = 169] | | | |--leaf "39" | | | `--[dendrogram w/ 2 branches and 4 members at h = 116] | | | |--[dendrogram w/ 2 branches and 2 members at h = 60.1] | | | | |--leaf "6" | | | | `--leaf "14" | | | `--[dendrogram w/ 2 branches and 2 members at h = 99.1] | | | |--leaf "2" | | | `--leaf "12" | | `--[dendrogram w/ 2 branches and 4 members at h = 214] | | |--leaf "24" | | `--[dendrogram w/ 2 branches and 3 members at h = 134] | | |--leaf "13" | | `--[dendrogram w/ 2 branches and 2 members at h = 71.3] | | |--leaf "11" | | `--leaf "21" | `--[dendrogram w/ 2 branches and 4 members at h = 2880] | |--[dendrogram w/ 2 branches and 2 members at h = 196] | | |--leaf "7" | | `--leaf "27" | `--[dendrogram w/ 2 branches and 2 members at h = 251] | |--leaf "3" | `--leaf "15" `--[dendrogram w/ 2 branches and 28 members at h = 9976] |--[dendrogram w/ 2 branches and 12 members at h = 1622] | |--[dendrogram w/ 2 branches and 4 members at h = 323] | | |--[dendrogram w/ 2 branches and 2 members at h = 114] | | | |--leaf "17" | | | `--leaf "33" | | `--[dendrogram w/ 2 branches and 2 members at h = 222] | | |--leaf "5" | | `--leaf "31" | `--[dendrogram w/ 2 branches and 8 members at h = 862] | |--[dendrogram w/ 2 branches and 4 members at h = 339] | | |--[dendrogram w/ 2 branches and 2 members at h = 78.9] | | | |--leaf "10" | | | `--leaf "26" | | `--[dendrogram w/ 2 branches and 2 members at h = 249] | | |--leaf "4" | | `--leaf "32" | `--[dendrogram w/ 2 branches and 4 members at h = 475] | |--leaf "51" | `--[dendrogram w/ 2 branches and 3 members at h = 217] | |--leaf "23" | `--[dendrogram w/ 2 branches and 2 members at h = 74] | |--leaf "16" | `--leaf "38" `--[dendrogram w/ 2 branches and 16 members at h = 1816] |--[dendrogram w/ 2 branches and 6 members at h = 885] | |--[dendrogram w/ 2 branches and 4 members at h = 138] | | |--leaf "25" | | `--[dendrogram w/ 2 branches and 3 members at h = 87] | | |--leaf "29" | | `--[dendrogram w/ 2 branches and 2 members at h = 70.2] | | |--leaf "22" | | `--leaf "28" | `--[dendrogram w/ 2 branches and 2 members at h = 353] | |--leaf "30" | `--leaf "36" `--[dendrogram w/ 2 branches and 10 members at h = 1261] |--[dendrogram w/ 2 branches and 7 members at h = 417] | |--leaf "63" | `--[dendrogram w/ 2 branches and 6 members at h = 383] | |--[dendrogram w/ 2 branches and 3 members at h = 106] | | |--leaf "45" | | `--[dendrogram w/ 2 branches and 2 members at h = 63.7] | | |--leaf "35" | | `--leaf "41" | `--[dendrogram w/ 2 branches and 3 members at h = 264] | |--leaf "67" | `--[dendrogram w/ 2 branches and 2 members at h = 166] | |--leaf "50" | `--leaf "55" `--[dendrogram w/ 2 branches and 3 members at h = 506] |--leaf "43" `--[dendrogram w/ 2 branches and 2 members at h = 245] |--leaf "44" `--leaf "47" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1j73l1226252154.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/22fen1226252154.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/3qhve1226252154.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/4b2d41226252154.tab") + } > > system("convert tmp/1j73l1226252154.ps tmp/1j73l1226252154.png") > system("convert tmp/22fen1226252154.ps tmp/22fen1226252154.png") convert: unable to open image `tmp/22fen1226252154.ps': No such file or directory. convert: missing an image filename `tmp/22fen1226252154.png'. > > > proc.time() user system elapsed 1.593 0.308 1.672