R version 2.7.2 (2008-08-25) 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(12301,10165,2136,310,269,41,910,708,202,2072,1362,710,3289,2271,1018,4693,3516,1177,6183,4775,1408,7252,6334,918,6703,6150,553,8217,7794,423,9731,8851,880,10778,9721,1057,11279,9676,1603,514,402,112,1350,1046,304,2537,1743,794,3612,2711,901,5049,3817,1232,5368,4128,1240,6537,5505,1032,6066,4921,1145,7679,6091,1588,9527,7263,2264,10244,8035,2209,10745,7828,2917,539,296,243,1058,500,558,2372,1134,1238,3563,2061,1502,4737,2737,2000,5105,2959,2146,6179,4113,2066,5540,3494,2046,6470,4518,1952,8241,5470,2771,8942,5664,3278,8717,4717,4000,-196,-606,410,492,-615,1107,560,-1062,1622,1003,-983,1986,1696,-340,2036,2867,467,2400,4316,1580,2736,3705,804,2901,4592,1709,2883,6082,2335,3747,6907,2832,4075,7578,2582,4996),dim=c(3,49),dimnames=list(c('Totaal','Goederen','Diensten'),1:49)) > y <- array(NA,dim=c(3,49),dimnames=list(c('Totaal','Goederen','Diensten'),1:49)) > 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 49 members at h = 107712] |--[dendrogram w/ 2 branches and 21 members at h = 20262] | |--[dendrogram w/ 2 branches and 11 members at h = 6303] | | |--[dendrogram w/ 2 branches and 6 members at h = 1738] | | | |--[dendrogram w/ 2 branches and 3 members at h = 317] | | | | |--leaf "2" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 170] | | | | |--leaf "14" | | | | `--leaf "26" | | | `--[dendrogram w/ 2 branches and 3 members at h = 676] | | | |--leaf "15" | | | `--[dendrogram w/ 2 branches and 2 members at h = 438] | | | |--leaf "3" | | | `--leaf "27" | | `--[dendrogram w/ 2 branches and 5 members at h = 2364] | | |--[dendrogram w/ 2 branches and 2 members at h = 979] | | | |--leaf "38" | | | `--leaf "39" | | `--[dendrogram w/ 2 branches and 3 members at h = 1377] | | |--leaf "42" | | `--[dendrogram w/ 2 branches and 2 members at h = 579] | | |--leaf "40" | | `--leaf "41" | `--[dendrogram w/ 2 branches and 10 members at h = 6657] | |--[dendrogram w/ 2 branches and 4 members at h = 2468] | | |--[dendrogram w/ 2 branches and 2 members at h = 338] | | | |--leaf "44" | | | `--leaf "46" | | `--[dendrogram w/ 2 branches and 2 members at h = 1033] | | |--leaf "43" | | `--leaf "45" | `--[dendrogram w/ 2 branches and 6 members at h = 3364] | |--[dendrogram w/ 2 branches and 3 members at h = 744] | | |--leaf "28" | | `--[dendrogram w/ 2 branches and 2 members at h = 607] | | |--leaf "4" | | `--leaf "16" | `--[dendrogram w/ 2 branches and 3 members at h = 801] | |--leaf "29" | `--[dendrogram w/ 2 branches and 2 members at h = 558] | |--leaf "5" | `--leaf "17" `--[dendrogram w/ 2 branches and 28 members at h = 42685] |--[dendrogram w/ 2 branches and 8 members at h = 6237] | |--[dendrogram w/ 2 branches and 3 members at h = 1866] | | |--leaf "1" | | `--[dendrogram w/ 2 branches and 2 members at h = 742] | | |--leaf "12" | | `--leaf "13" | `--[dendrogram w/ 2 branches and 5 members at h = 3876] | |--[dendrogram w/ 2 branches and 3 members at h = 1401] | | |--leaf "23" | | `--[dendrogram w/ 2 branches and 2 members at h = 892] | | |--leaf "24" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 2 members at h = 1902] | |--leaf "10" | `--leaf "11" `--[dendrogram w/ 2 branches and 20 members at h = 14406] |--[dendrogram w/ 2 branches and 6 members at h = 7889] | |--[dendrogram w/ 2 branches and 3 members at h = 1524] | | |--leaf "37" | | `--[dendrogram w/ 2 branches and 2 members at h = 887] | | |--leaf "35" | | `--leaf "36" | `--[dendrogram w/ 2 branches and 3 members at h = 1748] | |--leaf "49" | `--[dendrogram w/ 2 branches and 2 members at h = 1017] | |--leaf "47" | `--leaf "48" `--[dendrogram w/ 2 branches and 14 members at h = 10259] |--[dendrogram w/ 2 branches and 6 members at h = 2441] | |--[dendrogram w/ 2 branches and 3 members at h = 773] | | |--leaf "6" | | `--[dendrogram w/ 2 branches and 2 members at h = 446] | | |--leaf "18" | | `--leaf "19" | `--[dendrogram w/ 2 branches and 3 members at h = 1050] | |--leaf "33" | `--[dendrogram w/ 2 branches and 2 members at h = 454] | |--leaf "30" | `--leaf "31" `--[dendrogram w/ 2 branches and 8 members at h = 4519] |--[dendrogram w/ 2 branches and 3 members at h = 1275] | |--leaf "22" | `--[dendrogram w/ 2 branches and 2 members at h = 684] | |--leaf "8" | `--leaf "9" `--[dendrogram w/ 2 branches and 5 members at h = 1942] |--[dendrogram w/ 2 branches and 2 members at h = 512] | |--leaf "32" | `--leaf "34" `--[dendrogram w/ 2 branches and 3 members at h = 994] |--leaf "20" `--[dendrogram w/ 2 branches and 2 members at h = 323] |--leaf "7" `--leaf "21" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1mxbc1226592149.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/2eli21226592149.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/3b8xv1226592149.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/4n7su1226592149.tab") + } > > system("convert tmp/1mxbc1226592149.ps tmp/1mxbc1226592149.png") > system("convert tmp/2eli21226592149.ps tmp/2eli21226592149.png") convert: unable to open image `tmp/2eli21226592149.ps': No such file or directory. convert: missing an image filename `tmp/2eli21226592149.png'. > > > proc.time() user system elapsed 0.827 0.222 2.161