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(90.49 + ,91.25 + ,90.65 + ,91.5 + ,90.95 + ,91.68 + ,91.19 + ,91.81 + ,91.07 + ,91.84 + ,91.15 + ,91.93 + ,91.81 + ,92.08 + ,91.95 + ,92.11 + ,91.62 + ,92.26 + ,91.27 + ,92.28 + ,91.4 + ,92.39 + ,91.76 + ,92.46 + ,91.99 + ,92.82 + ,92.34 + ,93.16 + ,92.3 + ,93.33 + ,92.85 + ,93.51 + ,92.94 + ,93.56 + ,93.26 + ,93.67 + ,94.21 + ,93.76 + ,94.08 + ,93.88 + ,93.98 + ,94.01 + ,94.23 + ,94.21 + ,94.93 + ,94.31 + ,95.09 + ,94.4 + ,95.37 + ,94.9 + ,96.23 + ,95.31 + ,96.2 + ,95.52 + ,95.43 + ,95.68 + ,95.63 + ,95.91 + ,95.96 + ,95.97 + ,96.51 + ,96.15 + ,96.65 + ,96.34 + ,96.21 + ,96.42 + ,95.54 + ,96.54 + ,95.96 + ,96.72 + ,96.41 + ,96.81 + ,96.32 + ,97.19 + ,96.94 + ,97.5 + ,96.97 + ,97.71 + ,97.63 + ,97.86 + ,97.33 + ,98.04 + ,97.66 + ,98.2 + ,98.18 + ,98.25 + ,98.22 + ,98.41 + ,97.91 + ,98.56 + ,97.93 + ,98.62 + ,98.4 + ,98.75 + ,98.78 + ,98.71 + ,98.73 + ,99.05 + ,99.4 + ,99.52 + ,99.04 + ,99.71 + ,99.68 + ,99.8 + ,99.62 + ,100.01 + ,99.8 + ,99.99 + ,100.65 + ,100.12 + ,100.59 + ,100.15 + ,100.46 + ,100.27 + ,100.57 + ,100.42 + ,100.75 + ,100.43 + ,100.7 + ,100.5 + ,101.44 + ,100.95 + ,101.77 + ,101.26 + ,101.79 + ,101.42 + ,101.52 + ,101.68 + ,101.83 + ,101.75 + ,102.23 + ,101.89 + ,103.04 + ,102.07 + ,102.81 + ,102.22 + ,102.48 + ,102.45 + ,102.81 + ,102.62 + ,103.21 + ,102.67 + ,103.21 + ,102.86 + ,102.92 + ,104.78 + ,103.48 + ,104.87 + ,103.18 + ,105.06 + ,103.39 + ,105.14 + ,103.5 + ,105.32 + ,103.73 + ,105.54 + ,104.42 + ,105.68 + ,104.53 + ,105.77 + ,104.09 + ,106.07 + ,104.23 + ,106.03 + ,104.23 + ,106.13 + ,104.54 + ,106.28 + ,104.65 + ,106.61 + ,105.48 + ,106.74 + ,105.61 + ,107.01 + ,105.74 + ,107.1 + ,105.86 + ,107.28 + ,105.81 + ,107.4 + ,106.49 + ,107.59 + ,106.43 + ,107.69 + ,105.73 + ,107.78) + ,dim=c(2 + ,93) + ,dimnames=list(c('Diensten' + ,'Huur') + ,1:93)) > y <- array(NA,dim=c(2,93),dimnames=list(c('Diensten','Huur'),1:93)) > 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 93 members at h = 288] |--[dendrogram w/ 2 branches and 25 members at h = 25.1] | |--[dendrogram w/ 2 branches and 12 members at h = 3.65] | | |--[dendrogram w/ 2 branches and 6 members at h = 0.889] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.170] | | | | |--leaf "10" | | | | `--leaf "11" | | | `--[dendrogram w/ 2 branches and 4 members at h = 0.509] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.143] | | | | |--leaf "7" | | | | `--leaf "8" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.244] | | | |--leaf "9" | | | `--leaf "12" | | `--[dendrogram w/ 2 branches and 6 members at h = 1.43] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.297] | | | |--leaf "1" | | | `--leaf "2" | | `--[dendrogram w/ 2 branches and 4 members at h = 0.335] | | |--leaf "3" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.127] | | |--leaf "4" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.120] | | |--leaf "5" | | `--leaf "6" | `--[dendrogram w/ 2 branches and 13 members at h = 9.6] | |--[dendrogram w/ 2 branches and 6 members at h = 2.12] | | |--[dendrogram w/ 2 branches and 3 members at h = 0.485] | | | |--leaf "18" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.103] | | | |--leaf "16" | | | `--leaf "17" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.665] | | |--leaf "13" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.175] | | |--leaf "14" | | `--leaf "15" | `--[dendrogram w/ 2 branches and 7 members at h = 3.07] | |--[dendrogram w/ 2 branches and 4 members at h = 0.453] | | |--leaf "22" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.29] | | |--leaf "19" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.164] | | |--leaf "20" | | `--leaf "21" | `--[dendrogram w/ 2 branches and 3 members at h = 0.812] | |--leaf "25" | `--[dendrogram w/ 2 branches and 2 members at h = 0.184] | |--leaf "23" | `--leaf "24" `--[dendrogram w/ 2 branches and 68 members at h = 185] |--[dendrogram w/ 2 branches and 21 members at h = 18.6] | |--[dendrogram w/ 2 branches and 8 members at h = 2.03] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.117] | | | |--leaf "91" | | | `--leaf "92" | | `--[dendrogram w/ 2 branches and 6 members at h = 1.11] | | |--[dendrogram w/ 2 branches and 3 members at h = 0.443] | | | |--leaf "86" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.158] | | | |--leaf "87" | | | `--leaf "88" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.56] | | |--leaf "93" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.13] | | |--leaf "89" | | `--leaf "90" | `--[dendrogram w/ 2 branches and 13 members at h = 6.51] | |--[dendrogram w/ 2 branches and 6 members at h = 0.866] | | |--leaf "73" | | `--[dendrogram w/ 2 branches and 5 members at h = 0.722] | | |--leaf "78" | | `--[dendrogram w/ 2 branches and 4 members at h = 0.404] | | |--leaf "74" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.354] | | |--leaf "75" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.211] | | |--leaf "76" | | `--leaf "77" | `--[dendrogram w/ 2 branches and 7 members at h = 1.17] | |--[dendrogram w/ 2 branches and 2 members at h = 0.348] | | |--leaf "84" | | `--leaf "85" | `--[dendrogram w/ 2 branches and 5 members at h = 0.927] | |--[dendrogram w/ 2 branches and 2 members at h = 0.142] | | |--leaf "79" | | `--leaf "80" | `--[dendrogram w/ 2 branches and 3 members at h = 0.165] | |--leaf "81" | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | |--leaf "82" | `--leaf "83" `--[dendrogram w/ 2 branches and 47 members at h = 91.4] |--[dendrogram w/ 2 branches and 24 members at h = 23.5] | |--[dendrogram w/ 2 branches and 12 members at h = 3.4] | | |--[dendrogram w/ 2 branches and 5 members at h = 1.31] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.212] | | | | |--leaf "26" | | | | `--leaf "27" | | | `--[dendrogram w/ 2 branches and 3 members at h = 0.525] | | | |--leaf "30" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.305] | | | |--leaf "28" | | | `--leaf "29" | | `--[dendrogram w/ 2 branches and 7 members at h = 1.35] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.236] | | | |--leaf "31" | | | `--leaf "32" | | `--[dendrogram w/ 2 branches and 5 members at h = 1.04] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.391] | | | |--leaf "36" | | | `--leaf "37" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.628] | | |--leaf "34" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.391] | | |--leaf "33" | | `--leaf "35" | `--[dendrogram w/ 2 branches and 12 members at h = 4.73] | |--[dendrogram w/ 2 branches and 5 members at h = 1.37] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.212] | | | |--leaf "38" | | | `--leaf "39" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.364] | | |--leaf "41" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.341] | | |--leaf "40" | | `--leaf "42" | `--[dendrogram w/ 2 branches and 7 members at h = 1.66] | |--[dendrogram w/ 2 branches and 3 members at h = 0.438] | | |--leaf "47" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.344] | | |--leaf "48" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 4 members at h = 0.666] | |--[dendrogram w/ 2 branches and 2 members at h = 0.0632] | | |--leaf "45" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 2 members at h = 0.165] | |--leaf "43" | `--leaf "44" `--[dendrogram w/ 2 branches and 23 members at h = 23.7] |--[dendrogram w/ 2 branches and 11 members at h = 5.15] | |--[dendrogram w/ 2 branches and 6 members at h = 0.543] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.0671] | | | |--leaf "55" | | | `--leaf "56" | | `--[dendrogram w/ 2 branches and 4 members at h = 0.362] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.086] | | | |--leaf "59" | | | `--leaf "60" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.186] | | |--leaf "57" | | `--leaf "58" | `--[dendrogram w/ 2 branches and 5 members at h = 1.05] | |--[dendrogram w/ 2 branches and 3 members at h = 0.235] | | |--leaf "52" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.181] | | |--leaf "53" | | `--leaf "54" | `--[dendrogram w/ 2 branches and 2 members at h = 0.407] | |--leaf "50" | `--leaf "51" `--[dendrogram w/ 2 branches and 12 members at h = 6.53] |--[dendrogram w/ 2 branches and 6 members at h = 0.98] | |--leaf "61" | `--[dendrogram w/ 2 branches and 5 members at h = 0.818] | |--leaf "66" | `--[dendrogram w/ 2 branches and 4 members at h = 0.605] | |--[dendrogram w/ 2 branches and 2 members at h = 0.161] | | |--leaf "62" | | `--leaf "63" | `--[dendrogram w/ 2 branches and 2 members at h = 0.318] | |--leaf "64" | `--leaf "65" `--[dendrogram w/ 2 branches and 6 members at h = 1.17] |--[dendrogram w/ 2 branches and 2 members at h = 0.19] | |--leaf "71" | `--leaf "72" `--[dendrogram w/ 2 branches and 4 members at h = 0.715] |--[dendrogram w/ 2 branches and 2 members at h = 0.275] | |--leaf "67" | `--leaf "68" `--[dendrogram w/ 2 branches and 2 members at h = 0.371] |--leaf "69" `--leaf "70" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1yl5o1194253340.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/20eis1194253341.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/3zshk1194253342.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/4hqx91194253342.tab") + } > > system("convert tmp/1yl5o1194253340.ps tmp/1yl5o1194253340.png") > system("convert tmp/20eis1194253341.ps tmp/20eis1194253341.png") convert: unable to open image `tmp/20eis1194253341.ps': No such file or directory. convert: missing an image filename `tmp/20eis1194253341.png'. > > > proc.time() user system elapsed 1.763 0.309 1.859