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(8,-7,-6,-10,-13,-17,-24,-11,-44,-19,-9,-36,8,8,4,24,24,29,14,4,8,7,7,3,9,16,8,-26,-30,-49,19,26,32,15,19,25,-1,2,-1,-10,-12,-20,-21,-29,-34,-14,-24,-31,-27,-16,-12,26,25,25,23,22,25,5,-7,7,19,17,13,-19,-29,-40,24,18,32,17,15,14,1,1,-5,-9,6,-14,-16,-21,-42,-21,-23,-24,-14,-15,-11,31,24,20,27,15,7,10,15,12,12,14,4,-23,-25,-37,13,14,19,26,21,16,-1,13,2,4,4,-9,-16,-16,-36,-5,13,-29,9,20,3,23,27,33,9,-8,9,2,13,13,10,12,3,-29,-25,-47,17,20,18,9,22,7,9,16,16,-10,-12,-12,-23,-13,-23,13,7,-18,13,12,11,-9,-8,-4,9,12,17,5,-13,-4,8,12,-1,-18,-25,-41,7,0,26,4,18,3),dim=c(3,60),dimnames=list(c('woongebouwen','niet-woongebouwen','openbare_werken'),1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('woongebouwen','niet-woongebouwen','openbare_werken'),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 = 941] |--[dendrogram w/ 2 branches and 31 members at h = 167] | |--[dendrogram w/ 2 branches and 9 members at h = 41.2] | | |--[dendrogram w/ 2 branches and 6 members at h = 13.1] | | | |--[dendrogram w/ 2 branches and 2 members at h = 4.24] | | | | |--leaf "11" | | | | `--leaf "42" | | | `--[dendrogram w/ 2 branches and 4 members at h = 10.2] | | | |--leaf "23" | | | `--[dendrogram w/ 2 branches and 3 members at h = 4.7] | | | |--leaf "6" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.24] | | | |--leaf "18" | | | `--leaf "19" | | `--[dendrogram w/ 2 branches and 3 members at h = 15.8] | | |--leaf "31" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.07] | | |--leaf "30" | | `--leaf "36" | `--[dendrogram w/ 2 branches and 22 members at h = 69.8] | |--[dendrogram w/ 2 branches and 11 members at h = 28.8] | | |--[dendrogram w/ 2 branches and 6 members at h = 13.7] | | | |--leaf "7" | | | `--[dendrogram w/ 2 branches and 5 members at h = 10.8] | | | |--[dendrogram w/ 2 branches and 2 members at h = 1.73] | | | | |--leaf "5" | | | | `--leaf "8" | | | `--[dendrogram w/ 2 branches and 3 members at h = 6.45] | | | |--leaf "57" | | | `--[dendrogram w/ 2 branches and 2 members at h = 3] | | | |--leaf "33" | | | `--leaf "45" | | `--[dendrogram w/ 2 branches and 5 members at h = 17.3] | | |--[dendrogram w/ 2 branches and 3 members at h = 7.13] | | | |--leaf "60" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.47] | | | |--leaf "41" | | | `--leaf "48" | | `--[dendrogram w/ 2 branches and 2 members at h = 11.4] | | |--leaf "37" | | `--leaf "44" | `--[dendrogram w/ 2 branches and 11 members at h = 30.3] | |--leaf "59" | `--[dendrogram w/ 2 branches and 10 members at h = 22.4] | |--[dendrogram w/ 2 branches and 4 members at h = 13.4] | | |--[dendrogram w/ 2 branches and 2 members at h = 3] | | | |--leaf "21" | | | `--leaf "24" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.35] | | |--leaf "12" | | `--leaf "47" | `--[dendrogram w/ 2 branches and 6 members at h = 13.7] | |--[dendrogram w/ 2 branches and 3 members at h = 5.48] | | |--leaf "35" | | `--[dendrogram w/ 2 branches and 2 members at h = 4.12] | | |--leaf "49" | | `--leaf "55" | `--[dendrogram w/ 2 branches and 3 members at h = 5.76] | |--leaf "53" | `--[dendrogram w/ 2 branches and 2 members at h = 4.24] | |--leaf "9" | `--leaf "32" `--[dendrogram w/ 2 branches and 29 members at h = 328] |--[dendrogram w/ 2 branches and 14 members at h = 56.8] | |--[dendrogram w/ 2 branches and 7 members at h = 26] | | |--[dendrogram w/ 2 branches and 2 members at h = 6.16] | | | |--leaf "10" | | | `--leaf "46" | | `--[dendrogram w/ 2 branches and 5 members at h = 11.9] | | |--[dendrogram w/ 2 branches and 2 members at h = 5.39] | | | |--leaf "15" | | | `--leaf "34" | | `--[dendrogram w/ 2 branches and 3 members at h = 7.49] | | |--leaf "27" | | `--[dendrogram w/ 2 branches and 2 members at h = 4.24] | | |--leaf "22" | | `--leaf "58" | `--[dendrogram w/ 2 branches and 7 members at h = 38.3] | |--[dendrogram w/ 2 branches and 3 members at h = 12.1] | | |--leaf "3" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.62] | | |--leaf "4" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 4 members at h = 22] | |--[dendrogram w/ 2 branches and 2 members at h = 9.95] | | |--leaf "16" | | `--leaf "28" | `--[dendrogram w/ 2 branches and 2 members at h = 12.1] | |--leaf "17" | `--leaf "51" `--[dendrogram w/ 2 branches and 15 members at h = 77] |--[dendrogram w/ 2 branches and 5 members at h = 16.3] | |--leaf "54" | `--[dendrogram w/ 2 branches and 4 members at h = 11.3] | |--[dendrogram w/ 2 branches and 2 members at h = 3.16] | | |--leaf "2" | | `--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 5.1] | |--leaf "29" | `--leaf "50" `--[dendrogram w/ 2 branches and 10 members at h = 58] |--[dendrogram w/ 2 branches and 4 members at h = 21.9] | |--[dendrogram w/ 2 branches and 2 members at h = 4.58] | | |--leaf "20" | | `--leaf "43" | `--[dendrogram w/ 2 branches and 2 members at h = 7] | |--leaf "1" | `--leaf "56" `--[dendrogram w/ 2 branches and 6 members at h = 32.9] |--[dendrogram w/ 2 branches and 2 members at h = 17.0] | |--leaf "26" | `--leaf "40" `--[dendrogram w/ 2 branches and 4 members at h = 23.8] |--leaf "52" `--[dendrogram w/ 2 branches and 3 members at h = 8.79] |--leaf "38" `--[dendrogram w/ 2 branches and 2 members at h = 4.58] |--leaf "13" `--leaf "25" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/17kxx1226612468.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/2wsx21226612468.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/3695z1226612468.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/4koro1226612468.tab") + } > > system("convert tmp/17kxx1226612468.ps tmp/17kxx1226612468.png") > system("convert tmp/2wsx21226612468.ps tmp/2wsx21226612468.png") convert: unable to open image `tmp/2wsx21226612468.ps': No such file or directory. convert: missing an image filename `tmp/2wsx21226612468.png'. > > > proc.time() user system elapsed 0.801 0.216 0.905