R version 2.8.0 (2008-10-20) 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(5014 + ,2400 + ,3180 + ,1712 + ,6153 + ,4700 + ,4151 + ,2641 + ,6441 + ,3700 + ,4023 + ,2267 + ,5584 + ,2900 + ,3431 + ,2126 + ,6427 + ,2800 + ,3874 + ,2231 + ,6062 + ,3000 + ,2617 + ,1517 + ,5589 + ,3100 + ,3580 + ,2010 + ,6216 + ,3700 + ,5267 + ,2628 + ,5809 + ,3000 + ,3832 + ,2115 + ,4989 + ,2000 + ,3441 + ,1829 + ,6706 + ,1900 + ,3228 + ,1636 + ,7174 + ,1900 + ,3397 + ,1787 + ,6122 + ,1800 + ,3971 + ,2122 + ,8075 + ,3400 + ,4625 + ,2620 + ,6292 + ,3800 + ,4486 + ,2555 + ,6337 + ,2800 + ,4131 + ,2337 + ,8576 + ,3100 + ,4686 + ,2524 + ,6077 + ,2100 + ,3174 + ,1801 + ,5931 + ,2000 + ,4282 + ,2417 + ,6288 + ,2500 + ,4209 + ,2389 + ,7167 + ,2400 + ,4159 + ,2267 + ,6054 + ,2500 + ,3936 + ,2135 + ,6468 + ,3300 + ,3153 + ,1760 + ,6401 + ,3100 + ,3620 + ,1905 + ,6927 + ,3700 + ,4227 + ,2176 + ,7914 + ,5600 + ,4441 + ,2344 + ,7728 + ,3700 + ,4808 + ,2673 + ,8699 + ,2900 + ,4850 + ,2766 + ,8522 + ,4000 + ,5040 + ,2785 + ,6481 + ,2900 + ,3546 + ,2003 + ,7502 + ,2400 + ,4669 + ,2588 + ,7778 + ,3300 + ,5410 + ,2739 + ,7424 + ,3800 + ,5134 + ,2703 + ,6941 + ,4400 + ,4864 + ,2464 + ,8574 + ,4000 + ,3999 + ,1974 + ,9169 + ,3100 + ,4459 + ,2164 + ,7701 + ,2700 + ,4622 + ,2385 + ,9035 + ,5200 + ,5360 + ,2936 + ,7158 + ,4600 + ,4658 + ,2700 + ,8195 + ,3700 + ,5173 + ,2855 + ,8124 + ,3200 + ,4845 + ,2764 + ,7073 + ,2400 + ,3325 + ,1808 + ,7017 + ,2200 + ,4720 + ,2588 + ,7390 + ,3200 + ,4895 + ,2600 + ,7776 + ,3100 + ,5071 + ,2526 + ,6197 + ,2300 + ,4895 + ,2259 + ,6889 + ,2500 + ,3805 + ,1738 + ,7087 + ,2900 + ,4187 + ,1902 + ,6485 + ,2700 + ,4435 + ,2137 + ,7654 + ,5000 + ,4475 + ,2460 + ,6501 + ,3500 + ,4774 + ,2495 + ,6313 + ,3000 + ,5161 + ,2525 + ,7826 + ,3800 + ,4529 + ,2465 + ,6589 + ,2800 + ,3284 + ,1828 + ,6729 + ,2400 + ,4303 + ,2273 + ,5684 + ,2700 + ,4610 + ,2377 + ,8105 + ,2800 + ,4691 + ,2344 + ,6391 + ,2700 + ,4200 + ,2071 + ,5901 + ,2600 + ,3471 + ,1611 + ,6758 + ,3100 + ,3132 + ,1671) + ,dim=c(4 + ,60) + ,dimnames=list(c('bouwvergunningen' + ,'kredieten' + ,'woningen' + ,'gebouwen') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('bouwvergunningen','kredieten','woningen','gebouwen'),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 = 28532] |--[dendrogram w/ 2 branches and 34 members at h = 9006] | |--[dendrogram w/ 2 branches and 16 members at h = 4393] | | |--[dendrogram w/ 2 branches and 8 members at h = 2125] | | | |--[dendrogram w/ 2 branches and 2 members at h = 492] | | | | |--leaf "1" | | | | `--leaf "10" | | | `--[dendrogram w/ 2 branches and 6 members at h = 1815] | | | |--[dendrogram w/ 2 branches and 3 members at h = 465] | | | | |--leaf "9" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 275] | | | | |--leaf "4" | | | | `--leaf "7" | | | `--[dendrogram w/ 2 branches and 3 members at h = 1159] | | | |--leaf "6" | | | `--[dendrogram w/ 2 branches and 2 members at h = 637] | | | |--leaf "18" | | | `--leaf "59" | | `--[dendrogram w/ 2 branches and 8 members at h = 2841] | | |--[dendrogram w/ 2 branches and 3 members at h = 609] | | | |--leaf "11" | | | `--[dendrogram w/ 2 branches and 2 members at h = 516] | | | |--leaf "12" | | | `--leaf "42" | | `--[dendrogram w/ 2 branches and 5 members at h = 838] | | |--[dendrogram w/ 2 branches and 2 members at h = 364] | | | |--leaf "23" | | | `--leaf "60" | | `--[dendrogram w/ 2 branches and 3 members at h = 479] | | |--leaf "54" | | `--[dendrogram w/ 2 branches and 2 members at h = 248] | | |--leaf "24" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 18 members at h = 5016] | |--[dendrogram w/ 2 branches and 10 members at h = 1882] | | |--[dendrogram w/ 2 branches and 6 members at h = 622] | | | |--[dendrogram w/ 2 branches and 2 members at h = 262] | | | | |--leaf "49" | | | | `--leaf "58" | | | `--[dendrogram w/ 2 branches and 4 members at h = 537] | | | |--[dendrogram w/ 2 branches and 2 members at h = 292] | | | | |--leaf "5" | | | | `--leaf "16" | | | `--[dendrogram w/ 2 branches and 2 members at h = 440] | | | |--leaf "20" | | | `--leaf "22" | | `--[dendrogram w/ 2 branches and 4 members at h = 1304] | | |--[dendrogram w/ 2 branches and 2 members at h = 510] | | | |--leaf "13" | | | `--leaf "19" | | `--[dendrogram w/ 2 branches and 2 members at h = 720] | | |--leaf "46" | | `--leaf "56" | `--[dendrogram w/ 2 branches and 8 members at h = 2267] | |--[dendrogram w/ 2 branches and 3 members at h = 653] | | |--leaf "57" | | `--[dendrogram w/ 2 branches and 2 members at h = 416] | | |--leaf "31" | | `--leaf "37" | `--[dendrogram w/ 2 branches and 5 members at h = 1245] | |--[dendrogram w/ 2 branches and 2 members at h = 610] | | |--leaf "47" | | `--leaf "48" | `--[dendrogram w/ 2 branches and 3 members at h = 728] | |--leaf "43" | `--[dendrogram w/ 2 branches and 2 members at h = 461] | |--leaf "21" | `--leaf "55" `--[dendrogram w/ 2 branches and 26 members at h = 9976] |--[dendrogram w/ 2 branches and 9 members at h = 2572] | |--[dendrogram w/ 2 branches and 3 members at h = 1357] | | |--leaf "2" | | `--[dendrogram w/ 2 branches and 2 members at h = 430] | | |--leaf "34" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 6 members at h = 1708] | |--[dendrogram w/ 2 branches and 2 members at h = 535] | | |--leaf "3" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 4 members at h = 964] | |--[dendrogram w/ 2 branches and 2 members at h = 469] | | |--leaf "15" | | `--leaf "51" | `--[dendrogram w/ 2 branches and 2 members at h = 722] | |--leaf "8" | `--leaf "52" `--[dendrogram w/ 2 branches and 17 members at h = 5801] |--[dendrogram w/ 2 branches and 3 members at h = 2002] | |--leaf "38" | `--[dendrogram w/ 2 branches and 2 members at h = 665] | |--leaf "26" | `--leaf "50" `--[dendrogram w/ 2 branches and 14 members at h = 3378] |--[dendrogram w/ 2 branches and 10 members at h = 1568] | |--[dendrogram w/ 2 branches and 2 members at h = 469] | | |--leaf "29" | | `--leaf "40" | `--[dendrogram w/ 2 branches and 8 members at h = 1243] | |--[dendrogram w/ 2 branches and 3 members at h = 690] | | |--leaf "33" | | `--[dendrogram w/ 2 branches and 2 members at h = 375] | | |--leaf "27" | | `--leaf "53" | `--[dendrogram w/ 2 branches and 5 members at h = 1045] | |--[dendrogram w/ 2 branches and 2 members at h = 334] | | |--leaf "14" | | `--leaf "41" | `--[dendrogram w/ 2 branches and 3 members at h = 596] | |--leaf "32" | `--[dendrogram w/ 2 branches and 2 members at h = 442] | |--leaf "44" | `--leaf "45" `--[dendrogram w/ 2 branches and 4 members at h = 1695] |--leaf "35" `--[dendrogram w/ 2 branches and 3 members at h = 949] |--leaf "36" `--[dendrogram w/ 2 branches and 2 members at h = 375] |--leaf "17" `--leaf "28" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/12yvo1226431118.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/freestat/rcomp/tmp/242zg1226431118.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/3an8o1226431118.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/freestat/rcomp/tmp/4c3251226431118.tab") + } > > system("convert tmp/12yvo1226431118.ps tmp/12yvo1226431118.png") > system("convert tmp/242zg1226431118.ps tmp/242zg1226431118.png") convert: unable to open image `tmp/242zg1226431118.ps': No such file or directory. convert: missing an image filename `tmp/242zg1226431118.png'. > > > proc.time() user system elapsed 0.830 0.272 0.876