R version 2.7.0 (2008-04-22) 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(106.7 + ,97.3 + ,93.5 + ,104.8 + ,124.9 + ,110.2 + ,101 + ,94.7 + ,105.6 + ,132 + ,125.9 + ,113.2 + ,112.9 + ,118.3 + ,151.4 + ,100.1 + ,101 + ,99.2 + ,89.9 + ,108.9 + ,106.4 + ,105.7 + ,105.6 + ,90.2 + ,121.3 + ,114.8 + ,113.9 + ,113 + ,107 + ,123.4 + ,81.3 + ,86.4 + ,83.1 + ,64.5 + ,90.3 + ,87 + ,96.5 + ,81.1 + ,92.6 + ,79.3 + ,104.2 + ,103.3 + ,96.9 + ,95.8 + ,117.2 + ,108 + ,114.9 + ,104.3 + ,94.3 + ,116.9 + ,105 + ,105.8 + ,97.7 + ,91.2 + ,120.8 + ,94.5 + ,94.2 + ,102.6 + ,86.3 + ,96.1 + ,92 + ,98.4 + ,89.9 + ,77.6 + ,100.8 + ,95.9 + ,99.4 + ,96 + ,82.5 + ,105.3 + ,108.8 + ,108.8 + ,112.7 + ,97.7 + ,116.1 + ,103.4 + ,112.6 + ,107.1 + ,83.3 + ,112.8 + ,102.1 + ,104.4 + ,106.2 + ,84.2 + ,114.5 + ,110.1 + ,112.2 + ,121 + ,92.8 + ,117.2 + ,83.2 + ,81.1 + ,101.2 + ,77.4 + ,77.1 + ,82.7 + ,97.1 + ,83.2 + ,72.5 + ,80.1 + ,106.8 + ,112.6 + ,105.1 + ,88.8 + ,120.3 + ,113.7 + ,113.8 + ,113.3 + ,93.4 + ,133.4 + ,102.5 + ,107.8 + ,99.1 + ,92.6 + ,109.4 + ,96.6 + ,103.2 + ,100.3 + ,90.7 + ,93.2 + ,92.1 + ,103.3 + ,93.5 + ,81.6 + ,91.2 + ,95.6 + ,101.2 + ,98.8 + ,84.1 + ,99.2 + ,102.3 + ,107.7 + ,106.2 + ,88.1 + ,108.2 + ,98.6 + ,110.4 + ,98.3 + ,85.3 + ,101.5 + ,98.2 + ,101.9 + ,102.1 + ,82.9 + ,106.9 + ,104.5 + ,115.9 + ,117.1 + ,84.8 + ,104.4 + ,84 + ,89.9 + ,101.5 + ,71.2 + ,77.9 + ,73.8 + ,88.6 + ,80.5 + ,68.9 + ,60 + ,103.9 + ,117.2 + ,105.9 + ,94.3 + ,99.5 + ,106 + ,123.9 + ,109.5 + ,97.6 + ,95 + ,97.2 + ,100 + ,97.2 + ,85.6 + ,105.6 + ,102.6 + ,103.6 + ,114.5 + ,91.9 + ,102.5 + ,89 + ,94.1 + ,93.5 + ,75.8 + ,93.3 + ,93.8 + ,98.7 + ,100.9 + ,79.8 + ,97.3 + ,116.7 + ,119.5 + ,121.1 + ,99 + ,127 + ,106.8 + ,112.7 + ,116.5 + ,88.5 + ,111.7 + ,98.5 + ,104.4 + ,109.3 + ,86.7 + ,96.4 + ,118.7 + ,124.7 + ,118.1 + ,97.9 + ,133 + ,90 + ,89.1 + ,108.3 + ,94.3 + ,72.2 + ,91.9 + ,97 + ,105.4 + ,72.9 + ,95.8 + ,113.3 + ,121.6 + ,116.2 + ,91.8 + ,124.1 + ,113.1 + ,118.8 + ,111.2 + ,93.2 + ,127.6 + ,104.1 + ,114 + ,105.8 + ,86.5 + ,110.7 + ,108.7 + ,111.5 + ,122.7 + ,98.9 + ,104.6 + ,96.7 + ,97.2 + ,99.5 + ,77.2 + ,112.7 + ,101 + ,102.5 + ,107.9 + ,79.4 + ,115.3 + ,116.9 + ,113.4 + ,124.6 + ,90.4 + ,139.4 + ,105.8 + ,109.8 + ,115 + ,81.4 + ,119 + ,99 + ,104.9 + ,110.3 + ,85.8 + ,97.4 + ,129.4 + ,126.1 + ,132.7 + ,103.6 + ,154 + ,83 + ,80 + ,99.7 + ,73.6 + ,81.5 + ,88.9 + ,96.8 + ,96.5 + ,75.7 + ,88.8 + ,115.9 + ,117.2 + ,118.7 + ,99.2 + ,127.7 + ,104.2 + ,112.3 + ,112.9 + ,88.7 + ,105.1 + ,113.4 + ,117.3 + ,130.5 + ,94.6 + ,114.9 + ,112.2 + ,111.1 + ,137.9 + ,98.7 + ,106.4) + ,dim=c(5 + ,60) + ,dimnames=list(c('Totaal' + ,'Metaal' + ,'Machines' + ,'Elektrische_apparaten' + ,'Transportmiddelen') + ,1:60)) > y <- array(NA,dim=c(5,60),dimnames=list(c('Totaal','Metaal','Machines','Elektrische_apparaten','Transportmiddelen'),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 = 570] |--[dendrogram w/ 2 branches and 22 members at h = 157] | |--[dendrogram w/ 2 branches and 14 members at h = 39.4] | | |--[dendrogram w/ 2 branches and 4 members at h = 13.9] | | | |--[dendrogram w/ 2 branches and 2 members at h = 6.05] | | | | |--leaf "37" | | | | `--leaf "56" | | | `--[dendrogram w/ 2 branches and 2 members at h = 12.0] | | | |--leaf "13" | | | `--leaf "25" | | `--[dendrogram w/ 2 branches and 10 members at h = 28.9] | | |--[dendrogram w/ 2 branches and 4 members at h = 12.9] | | | |--leaf "49" | | | `--[dendrogram w/ 2 branches and 3 members at h = 7.66] | | | |--leaf "29" | | | `--[dendrogram w/ 2 branches and 2 members at h = 3.63] | | | |--leaf "14" | | | `--leaf "35" | | `--[dendrogram w/ 2 branches and 6 members at h = 20.7] | | |--[dendrogram w/ 2 branches and 2 members at h = 12.6] | | | |--leaf "24" | | | `--leaf "28" | | `--[dendrogram w/ 2 branches and 4 members at h = 14.9] | | |--leaf "44" | | `--[dendrogram w/ 2 branches and 3 members at h = 9.4] | | |--leaf "12" | | `--[dendrogram w/ 2 branches and 2 members at h = 6] | | |--leaf "26" | | `--leaf "38" | `--[dendrogram w/ 2 branches and 8 members at h = 46.9] | |--[dendrogram w/ 2 branches and 3 members at h = 31.5] | | |--leaf "32" | | `--[dendrogram w/ 2 branches and 2 members at h = 16.9] | | |--leaf "7" | | `--leaf "20" | `--[dendrogram w/ 2 branches and 5 members at h = 41.4] | |--[dendrogram w/ 2 branches and 3 members at h = 12.5] | | |--leaf "31" | | `--[dendrogram w/ 2 branches and 2 members at h = 6.11] | | |--leaf "19" | | `--leaf "55" | `--[dendrogram w/ 2 branches and 2 members at h = 29.3] | |--leaf "8" | `--leaf "43" `--[dendrogram w/ 2 branches and 38 members at h = 222] |--[dendrogram w/ 2 branches and 10 members at h = 69.8] | |--[dendrogram w/ 2 branches and 8 members at h = 23.1] | | |--leaf "51" | | `--[dendrogram w/ 2 branches and 7 members at h = 19.9] | | |--[dendrogram w/ 2 branches and 3 members at h = 11.4] | | | |--leaf "22" | | | `--[dendrogram w/ 2 branches and 2 members at h = 6.86] | | | |--leaf "45" | | | `--leaf "46" | | `--[dendrogram w/ 2 branches and 4 members at h = 17.7] | | |--leaf "6" | | `--[dendrogram w/ 2 branches and 3 members at h = 11.2] | | |--leaf "42" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.50] | | |--leaf "39" | | `--leaf "57" | `--[dendrogram w/ 2 branches and 2 members at h = 28.2] | |--leaf "3" | `--leaf "54" `--[dendrogram w/ 2 branches and 28 members at h = 88.7] |--[dendrogram w/ 2 branches and 6 members at h = 30.4] | |--[dendrogram w/ 2 branches and 3 members at h = 11.7] | | |--leaf "15" | | `--[dendrogram w/ 2 branches and 2 members at h = 8.95] | | |--leaf "18" | | `--leaf "40" | `--[dendrogram w/ 2 branches and 3 members at h = 16.3] | |--leaf "48" | `--[dendrogram w/ 2 branches and 2 members at h = 13.6] | |--leaf "59" | `--leaf "60" `--[dendrogram w/ 2 branches and 22 members at h = 78.1] |--[dendrogram w/ 2 branches and 2 members at h = 8.86] | |--leaf "1" | `--leaf "2" `--[dendrogram w/ 2 branches and 20 members at h = 65] |--[dendrogram w/ 2 branches and 5 members at h = 36.3] | |--[dendrogram w/ 2 branches and 2 members at h = 9.66] | | |--leaf "33" | | `--leaf "34" | `--[dendrogram w/ 2 branches and 3 members at h = 12.9] | |--leaf "36" | `--[dendrogram w/ 2 branches and 2 members at h = 1.82] | |--leaf "41" | `--leaf "53" `--[dendrogram w/ 2 branches and 15 members at h = 46.7] |--[dendrogram w/ 2 branches and 7 members at h = 25.1] | |--[dendrogram w/ 2 branches and 3 members at h = 9.88] | | |--leaf "5" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.01] | | |--leaf "10" | | `--leaf "21" | `--[dendrogram w/ 2 branches and 4 members at h = 16.6] | |--[dendrogram w/ 2 branches and 2 members at h = 6.45] | | |--leaf "9" | | `--leaf "11" | `--[dendrogram w/ 2 branches and 2 members at h = 7.72] | |--leaf "4" | `--leaf "23" `--[dendrogram w/ 2 branches and 8 members at h = 25.9] |--[dendrogram w/ 2 branches and 3 members at h = 14.3] | |--leaf "52" | `--[dendrogram w/ 2 branches and 2 members at h = 5.6] | |--leaf "17" | `--leaf "50" `--[dendrogram w/ 2 branches and 5 members at h = 19] |--[dendrogram w/ 2 branches and 2 members at h = 6.81] | |--leaf "30" | `--leaf "58" `--[dendrogram w/ 2 branches and 3 members at h = 8.94] |--leaf "27" `--[dendrogram w/ 2 branches and 2 members at h = 4.33] |--leaf "16" `--leaf "47" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/18sr71226407475.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/2hf9i1226407475.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/35c0z1226407475.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/4x03t1226407475.tab") + } > > system("convert tmp/18sr71226407475.ps tmp/18sr71226407475.png") > system("convert tmp/2hf9i1226407475.ps tmp/2hf9i1226407475.png") convert: unable to open image `tmp/2hf9i1226407475.ps': No such file or directory. convert: missing an image filename `tmp/2hf9i1226407475.png'. > > > proc.time() user system elapsed 1.555 0.301 1.630