R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(110.40 + ,109.20 + ,72.50 + ,96.40 + ,88.60 + ,59.40 + ,101.90 + ,94.30 + ,85.70 + ,106.20 + ,98.30 + ,88.20 + ,81.00 + ,86.40 + ,62.80 + ,94.70 + ,80.60 + ,87.00 + ,101.00 + ,104.10 + ,79.20 + ,109.40 + ,108.20 + ,112.00 + ,102.30 + ,93.40 + ,79.20 + ,90.70 + ,71.90 + ,132.10 + ,96.20 + ,94.10 + ,40.10 + ,96.10 + ,94.90 + ,69.00 + ,106.00 + ,96.40 + ,9.40 + ,103.10 + ,91.10 + ,73.80 + ,102.00 + ,84.40 + ,57.40 + ,104.70 + ,86.40 + ,81.10 + ,86.00 + ,88.00 + ,46.60 + ,92.10 + ,75.10 + ,41.40 + ,106.90 + ,109.70 + ,71.20 + ,112.60 + ,103.00 + ,67.90 + ,101.70 + ,82.10 + ,72.00 + ,92.00 + ,68.00 + ,145.50 + ,97.40 + ,96.40 + ,39.70 + ,97.00 + ,94.30 + ,51.90 + ,105.40 + ,90.00 + ,73.70 + ,102.70 + ,88.00 + ,70.90 + ,98.10 + ,76.10 + ,60.80 + ,104.50 + ,82.50 + ,61.00 + ,87.40 + ,81.40 + ,54.50 + ,89.90 + ,66.50 + ,39.10 + ,109.80 + ,97.20 + ,66.60 + ,111.70 + ,94.10 + ,58.50 + ,98.60 + ,80.70 + ,59.80 + ,96.90 + ,70.50 + ,80.90 + ,95.10 + ,87.80 + ,37.30 + ,97.00 + ,89.50 + ,44.60 + ,112.70 + ,99.60 + ,48.70 + ,102.90 + ,84.20 + ,54.00 + ,97.40 + ,75.10 + ,49.50 + ,111.40 + ,92.00 + ,61.60 + ,87.40 + ,80.80 + ,35.00 + ,96.80 + ,73.10 + ,35.70 + ,114.10 + ,99.80 + ,51.30 + ,110.30 + ,90.00 + ,49.00 + ,103.90 + ,83.10 + ,41.50 + ,101.60 + ,72.40 + ,72.50 + ,94.60 + ,78.80 + ,42.10 + ,95.90 + ,87.30 + ,44.10 + ,104.70 + ,91.00 + ,45.10 + ,102.80 + ,80.10 + ,50.30 + ,98.10 + ,73.60 + ,40.90 + ,113.90 + ,86.40 + ,47.20 + ,80.90 + ,74.50 + ,36.90 + ,95.70 + ,71.20 + ,40.90 + ,113.20 + ,92.40 + ,38.30 + ,105.90 + ,81.50 + ,46.30 + ,108.80 + ,85.30 + ,28.40 + ,102.30 + ,69.90 + ,78.40 + ,99.00 + ,84.20 + ,36.80 + ,100.70 + ,90.70 + ,50.70 + ,115.50 + ,100.30 + ,42.80) + ,dim=c(3 + ,61) + ,dimnames=list(c('totaal' + ,'kleding' + ,'investering') + ,1:61)) > y <- array(NA,dim=c(3,61),dimnames=list(c('totaal','kleding','investering'),1:61)) > 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: Wessa, P., (2007), Hierarchical Clustering (v1.0.1) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_hierarchicalclustering.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 61 members at h = 514] |--[dendrogram w/ 2 branches and 38 members at h = 132] | |--[dendrogram w/ 2 branches and 17 members at h = 67.3] | | |--[dendrogram w/ 2 branches and 7 members at h = 25.1] | | | |--[dendrogram w/ 2 branches and 3 members at h = 9.14] | | | | |--leaf "61" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 2.96] | | | | |--leaf "37" | | | | `--leaf "43" | | | `--[dendrogram w/ 2 branches and 4 members at h = 12.7] | | | |--leaf "55" | | | `--[dendrogram w/ 2 branches and 3 members at h = 9.8] | | | |--leaf "49" | | | `--[dendrogram w/ 2 branches and 2 members at h = 5.4] | | | |--leaf "44" | | | `--leaf "52" | | `--[dendrogram w/ 2 branches and 10 members at h = 58.1] | | |--[dendrogram w/ 2 branches and 2 members at h = 22.2] | | | |--leaf "13" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 8 members at h = 23.6] | | |--[dendrogram w/ 2 branches and 2 members at h = 5.3] | | | |--leaf "24" | | | `--leaf "60" | | `--[dendrogram w/ 2 branches and 6 members at h = 15.7] | | |--[dendrogram w/ 2 branches and 2 members at h = 2.62] | | | |--leaf "11" | | | `--leaf "23" | | `--[dendrogram w/ 2 branches and 4 members at h = 12.5] | | |--[dendrogram w/ 2 branches and 2 members at h = 2.51] | | | |--leaf "36" | | | `--leaf "48" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.33] | | |--leaf "35" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 21 members at h = 101] | |--[dendrogram w/ 2 branches and 8 members at h = 24.8] | | |--[dendrogram w/ 2 branches and 2 members at h = 9.25] | | | |--leaf "41" | | | `--leaf "53" | | `--[dendrogram w/ 2 branches and 6 members at h = 13.1] | | |--leaf "30" | | `--[dendrogram w/ 2 branches and 5 members at h = 10.3] | | |--[dendrogram w/ 2 branches and 2 members at h = 4.52] | | | |--leaf "18" | | | `--leaf "47" | | `--[dendrogram w/ 2 branches and 3 members at h = 6.22] | | |--leaf "42" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.39] | | |--leaf "51" | | `--leaf "54" | `--[dendrogram w/ 2 branches and 13 members at h = 47.5] | |--[dendrogram w/ 2 branches and 3 members at h = 15.6] | | |--leaf "5" | | `--[dendrogram w/ 2 branches and 2 members at h = 10.4] | | |--leaf "17" | | `--leaf "29" | `--[dendrogram w/ 2 branches and 10 members at h = 36.0] | |--[dendrogram w/ 2 branches and 4 members at h = 12.4] | | |--leaf "39" | | `--[dendrogram w/ 2 branches and 3 members at h = 8.12] | | |--leaf "45" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.25] | | |--leaf "50" | | `--leaf "56" | `--[dendrogram w/ 2 branches and 6 members at h = 13.5] | |--[dendrogram w/ 2 branches and 2 members at h = 4.73] | | |--leaf "27" | | `--leaf "33" | `--[dendrogram w/ 2 branches and 4 members at h = 10.9] | |--leaf "2" | `--[dendrogram w/ 2 branches and 3 members at h = 6.93] | |--leaf "28" | `--[dendrogram w/ 2 branches and 2 members at h = 3.52] | |--leaf "15" | `--leaf "38" `--[dendrogram w/ 2 branches and 23 members at h = 201] |--[dendrogram w/ 2 branches and 2 members at h = 14.0] | |--leaf "10" | `--leaf "22" `--[dendrogram w/ 2 branches and 21 members at h = 96.5] |--[dendrogram w/ 2 branches and 7 members at h = 37.9] | |--[dendrogram w/ 2 branches and 3 members at h = 14.8] | | |--leaf "7" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.77] | | |--leaf "1" | | `--leaf "19" | `--[dendrogram w/ 2 branches and 4 members at h = 15.8] | |--[dendrogram w/ 2 branches and 2 members at h = 3.76] | | |--leaf "32" | | `--leaf "40" | `--[dendrogram w/ 2 branches and 2 members at h = 6.57] | |--leaf "20" | `--leaf "31" `--[dendrogram w/ 2 branches and 14 members at h = 66.5] |--[dendrogram w/ 2 branches and 4 members at h = 19.2] | |--leaf "6" | `--[dendrogram w/ 2 branches and 3 members at h = 8.84] | |--leaf "46" | `--[dendrogram w/ 2 branches and 2 members at h = 5.98] | |--leaf "34" | `--leaf "58" `--[dendrogram w/ 2 branches and 10 members at h = 62.4] |--leaf "8" `--[dendrogram w/ 2 branches and 9 members at h = 32.7] |--[dendrogram w/ 2 branches and 4 members at h = 13.5] | |--[dendrogram w/ 2 branches and 2 members at h = 6.38] | | |--leaf "3" | | `--leaf "4" | `--[dendrogram w/ 2 branches and 2 members at h = 7.64] | |--leaf "9" | `--leaf "16" `--[dendrogram w/ 2 branches and 5 members at h = 14.4] |--leaf "12" `--[dendrogram w/ 2 branches and 4 members at h = 10.3] |--leaf "21" `--[dendrogram w/ 2 branches and 3 members at h = 4.91] |--leaf "26" `--[dendrogram w/ 2 branches and 2 members at h = 2.55] |--leaf "14" `--leaf "25" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1g95s1194302267.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/28or81194302268.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) + } > 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/3cg131194302268.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/4zmoe1194302268.tab") + } > > system("convert tmp/1g95s1194302267.ps tmp/1g95s1194302267.png") > system("convert tmp/28or81194302268.ps tmp/28or81194302268.png") convert: unable to open image `tmp/28or81194302268.ps': No such file or directory. convert: missing an image filename `tmp/28or81194302268.png'. > > > proc.time() user system elapsed 0.847 0.216 0.968