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(106.8 + ,112.6 + ,105.1 + ,88.8 + ,113.7 + ,113.8 + ,113.3 + ,93.4 + ,102.5 + ,107.8 + ,99.1 + ,92.6 + ,96.6 + ,103.2 + ,100.3 + ,90.7 + ,92.1 + ,103.3 + ,93.5 + ,81.6 + ,95.6 + ,101.2 + ,98.8 + ,84.1 + ,102.3 + ,107.7 + ,106.2 + ,88.1 + ,98.6 + ,110.4 + ,98.3 + ,85.3 + ,98.2 + ,101.9 + ,102.1 + ,82.9 + ,104.5 + ,115.9 + ,117.1 + ,84.8 + ,84.0 + ,89.9 + ,101.5 + ,71.2 + ,73.8 + ,88.6 + ,80.5 + ,68.9 + ,103.9 + ,117.2 + ,105.9 + ,94.3 + ,106.0 + ,123.9 + ,109.5 + ,97.6 + ,97.2 + ,100.0 + ,97.2 + ,85.6 + ,102.6 + ,103.6 + ,114.5 + ,91.9 + ,89.0 + ,94.1 + ,93.5 + ,75.8 + ,93.8 + ,98.7 + ,100.9 + ,79.8 + ,116.7 + ,119.5 + ,121.1 + ,99.0 + ,106.8 + ,112.7 + ,116.5 + ,88.5 + ,98.5 + ,104.4 + ,109.3 + ,86.7 + ,118.7 + ,124.7 + ,118.1 + ,97.9 + ,90.0 + ,89.1 + ,108.3 + ,94.3 + ,91.9 + ,97.0 + ,105.4 + ,72.9 + ,113.3 + ,121.6 + ,116.2 + ,91.8 + ,113.1 + ,118.8 + ,111.2 + ,93.2 + ,104.1 + ,114.0 + ,105.8 + ,86.5 + ,108.7 + ,111.5 + ,122.7 + ,98.9 + ,96.7 + ,97.2 + ,99.5 + ,77.2 + ,101.0 + ,102.5 + ,107.9 + ,79.4 + ,116.9 + ,113.4 + ,124.6 + ,90.4 + ,105.8 + ,109.8 + ,115.0 + ,81.4 + ,99.0 + ,104.9 + ,110.3 + ,85.8 + ,129.4 + ,126.1 + ,132.7 + ,103.6 + ,83.0 + ,80.0 + ,99.7 + ,73.6 + ,88.9 + ,96.8 + ,96.5 + ,75.7 + ,115.9 + ,117.2 + ,118.7 + ,99.2 + ,104.2 + ,112.3 + ,112.9 + ,88.7 + ,113.4 + ,117.3 + ,130.5 + ,94.6 + ,112.2 + ,111.1 + ,137.9 + ,98.7 + ,100.8 + ,102.2 + ,115.0 + ,84.2 + ,107.3 + ,104.3 + ,116.8 + ,87.7 + ,126.6 + ,122.9 + ,140.9 + ,103.3 + ,102.9 + ,107.6 + ,120.7 + ,88.2 + ,117.9 + ,121.3 + ,134.2 + ,93.4 + ,128.8 + ,131.5 + ,147.3 + ,106.3 + ,87.5 + ,89.0 + ,112.4 + ,73.1 + ,93.8 + ,104.4 + ,107.1 + ,78.6 + ,122.7 + ,128.9 + ,128.4 + ,101.6 + ,126.2 + ,135.9 + ,137.7 + ,101.4 + ,124.6 + ,133.3 + ,135.0 + ,98.5 + ,116.7 + ,121.3 + ,151.0 + ,99.0 + ,115.2 + ,120.5 + ,137.4 + ,89.5 + ,111.1 + ,120.4 + ,132.4 + ,83.5 + ,129.9 + ,137.9 + ,161.3 + ,97.4 + ,113.3 + ,126.1 + ,139.8 + ,87.8 + ,118.5 + ,133.2 + ,146.0 + ,90.4 + ,133.5 + ,146.6 + ,154.6 + ,97.1 + ,102.1 + ,103.4 + ,142.1 + ,79.4 + ,102.4 + ,117.2 + ,120.5 + ,85.0) + ,dim=c(4 + ,60) + ,dimnames=list(c('Totaal' + ,'Metaal' + ,'Machines' + ,'Apparaten') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('Totaal','Metaal','Machines','Apparaten'),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: 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 60 members at h = 602] |--[dendrogram w/ 2 branches and 19 members at h = 111] | |--[dendrogram w/ 2 branches and 11 members at h = 43.7] | | |--[dendrogram w/ 2 branches and 6 members at h = 27.6] | | | |--[dendrogram w/ 2 branches and 4 members at h = 12.0] | | | | |--leaf "54" | | | | `--[dendrogram w/ 2 branches and 3 members at h = 9.37] | | | | |--leaf "56" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 5.78] | | | | |--leaf "45" | | | | `--leaf "53" | | | `--[dendrogram w/ 2 branches and 2 members at h = 15.6] | | | |--leaf "52" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 5 members at h = 35] | | |--leaf "59" | | `--[dendrogram w/ 2 branches and 4 members at h = 15.9] | | |--leaf "40" | | `--[dendrogram w/ 2 branches and 3 members at h = 12.8] | | |--leaf "28" | | `--[dendrogram w/ 2 branches and 2 members at h = 8.94] | | |--leaf "31" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 8 members at h = 56.8] | |--[dendrogram w/ 2 branches and 2 members at h = 11.6] | | |--leaf "55" | | `--leaf "58" | `--[dendrogram w/ 2 branches and 6 members at h = 21.0] | |--[dendrogram w/ 2 branches and 2 members at h = 11.3] | | |--leaf "43" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 4 members at h = 14.6] | |--[dendrogram w/ 2 branches and 2 members at h = 5] | | |--leaf "50" | | `--leaf "51" | `--[dendrogram w/ 2 branches and 2 members at h = 8.67] | |--leaf "34" | `--leaf "49" `--[dendrogram w/ 2 branches and 41 members at h = 269] |--[dendrogram w/ 2 branches and 14 members at h = 56.9] | |--[dendrogram w/ 2 branches and 9 members at h = 24.8] | | |--[dendrogram w/ 2 branches and 4 members at h = 10.8] | | | |--leaf "5" | | | `--[dendrogram w/ 2 branches and 3 members at h = 5.96] | | | |--leaf "9" | | | `--[dendrogram w/ 2 branches and 2 members at h = 2.97] | | | |--leaf "6" | | | `--leaf "15" | | `--[dendrogram w/ 2 branches and 5 members at h = 15.9] | | |--[dendrogram w/ 2 branches and 2 members at h = 4.04] | | | |--leaf "17" | | | `--leaf "36" | | `--[dendrogram w/ 2 branches and 3 members at h = 10.1] | | |--leaf "24" | | `--[dendrogram w/ 2 branches and 2 members at h = 4.4] | | |--leaf "18" | | `--leaf "29" | `--[dendrogram w/ 2 branches and 5 members at h = 38.2] | |--leaf "12" | `--[dendrogram w/ 2 branches and 4 members at h = 29.5] | |--leaf "23" | `--[dendrogram w/ 2 branches and 3 members at h = 15.1] | |--leaf "47" | `--[dendrogram w/ 2 branches and 2 members at h = 10.4] | |--leaf "11" | `--leaf "35" `--[dendrogram w/ 2 branches and 27 members at h = 114] |--[dendrogram w/ 2 branches and 8 members at h = 27.8] | |--[dendrogram w/ 2 branches and 3 members at h = 8.56] | | |--leaf "22" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.42] | | |--leaf "19" | | `--leaf "37" | `--[dendrogram w/ 2 branches and 5 members at h = 19.2] | |--[dendrogram w/ 2 branches and 3 members at h = 7.77] | | |--leaf "25" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.46] | | |--leaf "2" | | `--leaf "26" | `--[dendrogram w/ 2 branches and 2 members at h = 8.55] | |--leaf "13" | `--leaf "14" `--[dendrogram w/ 2 branches and 19 members at h = 57.5] |--[dendrogram w/ 2 branches and 8 members at h = 20.9] | |--[dendrogram w/ 2 branches and 3 members at h = 7.76] | | |--leaf "44" | | `--[dendrogram w/ 2 branches and 2 members at h = 6.75] | | |--leaf "16" | | `--leaf "42" | `--[dendrogram w/ 2 branches and 5 members at h = 11.3] | |--[dendrogram w/ 2 branches and 2 members at h = 4.21] | | |--leaf "10" | | `--leaf "60" | `--[dendrogram w/ 2 branches and 3 members at h = 9.2] | |--leaf "32" | `--[dendrogram w/ 2 branches and 2 members at h = 4.46] | |--leaf "20" | `--leaf "38" `--[dendrogram w/ 2 branches and 11 members at h = 36.2] |--[dendrogram w/ 2 branches and 5 members at h = 13.8] | |--[dendrogram w/ 2 branches and 2 members at h = 7.53] | | |--leaf "30" | | `--leaf "48" | `--[dendrogram w/ 2 branches and 3 members at h = 8.1] | |--leaf "41" | `--[dendrogram w/ 2 branches and 2 members at h = 1.52] | |--leaf "21" | `--leaf "33" `--[dendrogram w/ 2 branches and 6 members at h = 18.7] |--[dendrogram w/ 2 branches and 3 members at h = 7.73] | |--leaf "7" | `--[dendrogram w/ 2 branches and 2 members at h = 3.88] | |--leaf "1" | `--leaf "27" `--[dendrogram w/ 2 branches and 3 members at h = 9.5] |--leaf "8" `--[dendrogram w/ 2 branches and 2 members at h = 7.81] |--leaf "3" `--leaf "4" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1656p1194293762.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/2fci61194293763.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/33uqk1194293763.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/4yr5c1194293763.tab") + } > > system("convert tmp/1656p1194293762.ps tmp/1656p1194293762.png") > system("convert tmp/2fci61194293763.ps tmp/2fci61194293763.png") convert: unable to open image `tmp/2fci61194293763.ps': No such file or directory. convert: missing an image filename `tmp/2fci61194293763.png'. > > > proc.time() user system elapsed 0.862 0.201 0.944