R version 2.7.2 (2008-08-25) 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(81.1 + ,92.3 + ,95.5 + ,79.3 + ,96.9 + ,95.5 + ,98.7 + ,117.2 + ,104.3 + ,92.5 + ,115.9 + ,116.9 + ,97.7 + ,89.6 + ,110.4 + ,120.8 + ,102.6 + ,84.3 + ,109.5 + ,96.1 + ,89.9 + ,76.3 + ,92.3 + ,100.8 + ,96 + ,80.7 + ,102.1 + ,105.3 + ,112.7 + ,96.3 + ,112.8 + ,116.1 + ,107.1 + ,81 + ,110.2 + ,112.8 + ,106.2 + ,82.9 + ,98.9 + ,114.5 + ,121 + ,90.3 + ,119 + ,117.2 + ,101.2 + ,74.8 + ,104.3 + ,77.1 + ,83.2 + ,70.1 + ,98.8 + ,80.1 + ,105.1 + ,86.7 + ,109.4 + ,120.3 + ,113.3 + ,86.4 + ,170.3 + ,133.4 + ,99.1 + ,89.9 + ,118 + ,109.4 + ,100.3 + ,88.1 + ,116.9 + ,93.2 + ,93.5 + ,78.8 + ,111.7 + ,91.2 + ,98.8 + ,81.1 + ,116.8 + ,99.2 + ,106.2 + ,85.4 + ,116.1 + ,108.2 + ,98.3 + ,82.6 + ,114.8 + ,101.5 + ,102.1 + ,80.3 + ,110.8 + ,106.9 + ,117.1 + ,81.2 + ,122.8 + ,104.4 + ,101.5 + ,68 + ,104.7 + ,77.9 + ,80.5 + ,67.4 + ,86 + ,60 + ,105.9 + ,91.3 + ,127.2 + ,99.5 + ,109.5 + ,94.9 + ,126.1 + ,95 + ,97.2 + ,82.8 + ,114.6 + ,105.6 + ,114.5 + ,88.6 + ,127.8 + ,102.5 + ,93.5 + ,73.1 + ,105.2 + ,93.3 + ,100.9 + ,76.7 + ,113.1 + ,97.3 + ,121.1 + ,93.2 + ,161 + ,127 + ,116.5 + ,84.9 + ,126.9 + ,111.7 + ,109.3 + ,83.8 + ,117.7 + ,96.4 + ,118.1 + ,93.5 + ,144.9 + ,133 + ,108.3 + ,91.9 + ,119.4 + ,72.2 + ,105.4 + ,69.6 + ,107.1 + ,95.8 + ,116.2 + ,87 + ,142.8 + ,124.1 + ,111.2 + ,90.2 + ,126.2 + ,127.6 + ,105.8 + ,82.7 + ,126.9 + ,110.7 + ,122.7 + ,91.4 + ,179.2 + ,104.6 + ,99.5 + ,74.6 + ,105.3 + ,112.7 + ,107.9 + ,76.1 + ,114.8 + ,115.3 + ,124.6 + ,87.1 + ,125.4 + ,139.4 + ,115 + ,78.4 + ,113.2 + ,119 + ,110.3 + ,81.3 + ,134.4 + ,97.4 + ,132.7 + ,99.3 + ,150 + ,154 + ,99.7 + ,71 + ,100.9 + ,81.5 + ,96.5 + ,73.2 + ,101.8 + ,88.8 + ,118.7 + ,95.6 + ,137.7 + ,127.7 + ,112.9 + ,84 + ,138.7 + ,105.1 + ,130.5 + ,90.8 + ,135.4 + ,114.9 + ,137.9 + ,93.6 + ,153.8 + ,106.4 + ,115 + ,80.9 + ,119.5 + ,104.5 + ,116.8 + ,84.4 + ,123.3 + ,121.6 + ,140.9 + ,97.3 + ,166.4 + ,141.4 + ,120.7 + ,83.5 + ,137.5 + ,99 + ,134.2 + ,88.8 + ,142.2 + ,126.7 + ,147.3 + ,100.7 + ,167 + ,134.1 + ,112.4 + ,69.4 + ,112.3 + ,81.3 + ,107.1 + ,74.6 + ,120.6 + ,88.6 + ,128.4 + ,96.6 + ,154.9 + ,132.7 + ,137.7 + ,96.6 + ,153.4 + ,132.9 + ,135 + ,93.1 + ,156.2 + ,134.4 + ,151 + ,91.8 + ,175.8 + ,103.7 + ,137.4 + ,85.7 + ,131.7 + ,119.7 + ,132.4 + ,79.1 + ,130.1 + ,115 + ,161.3 + ,91.3 + ,161.1 + ,132.9 + ,139.8 + ,84.2 + ,128.2 + ,108.5 + ,146 + ,85.8 + ,140.3 + ,113.9 + ,166.5 + ,94.6 + ,174.9 + ,142 + ,143.3 + ,77.1 + ,111.8 + ,97.7 + ,121 + ,76.5 + ,136.6 + ,92.2) + ,dim=c(4 + ,73) + ,dimnames=list(c('Machines' + ,'Electronische' + ,'Medische' + ,'Transportmiddelen') + ,1:73)) > y <- array(NA,dim=c(4,73),dimnames=list(c('Machines','Electronische','Medische','Transportmiddelen'),1:73)) > 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 73 members at h = 825] |--[dendrogram w/ 2 branches and 35 members at h = 223] | |--[dendrogram w/ 2 branches and 12 members at h = 73.8] | | |--[dendrogram w/ 2 branches and 3 members at h = 30.5] | | | |--leaf "25" | | | `--[dendrogram w/ 2 branches and 2 members at h = 22.6] | | | |--leaf "1" | | | `--leaf "13" | | `--[dendrogram w/ 2 branches and 9 members at h = 43.6] | | |--[dendrogram w/ 2 branches and 3 members at h = 28.6] | | | |--leaf "36" | | | `--[dendrogram w/ 2 branches and 2 members at h = 13.3] | | | |--leaf "60" | | | `--leaf "61" | | `--[dendrogram w/ 2 branches and 6 members at h = 29.3] | | |--[dendrogram w/ 2 branches and 3 members at h = 7.08] | | | |--leaf "12" | | | `--[dendrogram w/ 2 branches and 2 members at h = 6.3] | | | |--leaf "24" | | | `--leaf "48" | | `--[dendrogram w/ 2 branches and 3 members at h = 15.1] | | |--leaf "37" | | `--[dendrogram w/ 2 branches and 2 members at h = 6.39] | | |--leaf "30" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 23 members at h = 87.8] | |--[dendrogram w/ 2 branches and 10 members at h = 24.5] | | |--[dendrogram w/ 2 branches and 5 members at h = 14.2] | | | |--[dendrogram w/ 2 branches and 3 members at h = 6.46] | | | | |--leaf "28" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 3.43] | | | | |--leaf "19" | | | | `--leaf "21" | | | `--[dendrogram w/ 2 branches and 2 members at h = 8.52] | | | |--leaf "20" | | | `--leaf "22" | | `--[dendrogram w/ 2 branches and 5 members at h = 15.8] | | |--[dendrogram w/ 2 branches and 2 members at h = 10.5] | | | |--leaf "17" | | | `--leaf "34" | | `--[dendrogram w/ 2 branches and 3 members at h = 11.7] | | |--leaf "18" | | `--[dendrogram w/ 2 branches and 2 members at h = 8.66] | | |--leaf "5" | | `--leaf "31" | `--[dendrogram w/ 2 branches and 13 members at h = 52.8] | |--[dendrogram w/ 2 branches and 4 members at h = 22] | | |--leaf "6" | | `--[dendrogram w/ 2 branches and 3 members at h = 14.3] | | |--leaf "10" | | `--[dendrogram w/ 2 branches and 2 members at h = 10.7] | | |--leaf "7" | | `--leaf "42" | `--[dendrogram w/ 2 branches and 9 members at h = 37.2] | |--[dendrogram w/ 2 branches and 3 members at h = 10.4] | | |--leaf "45" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.22] | | |--leaf "9" | | `--leaf "43" | `--[dendrogram w/ 2 branches and 6 members at h = 22.4] | |--leaf "2" | `--[dendrogram w/ 2 branches and 5 members at h = 17.0] | |--[dendrogram w/ 2 branches and 2 members at h = 8.03] | | |--leaf "4" | | `--leaf "14" | `--[dendrogram w/ 2 branches and 3 members at h = 14.8] | |--leaf "8" | `--[dendrogram w/ 2 branches and 2 members at h = 9.72] | |--leaf "3" | `--leaf "16" `--[dendrogram w/ 2 branches and 38 members at h = 373] |--[dendrogram w/ 2 branches and 13 members at h = 88.2] | |--[dendrogram w/ 2 branches and 3 members at h = 30.2] | | |--leaf "41" | | `--[dendrogram w/ 2 branches and 2 members at h = 25.8] | | |--leaf "53" | | `--leaf "65" | `--[dendrogram w/ 2 branches and 10 members at h = 70.7] | |--[dendrogram w/ 2 branches and 2 members at h = 17.6] | | |--leaf "68" | | `--leaf "71" | `--[dendrogram w/ 2 branches and 8 members at h = 47.2] | |--[dendrogram w/ 2 branches and 2 members at h = 15.3] | | |--leaf "15" | | `--leaf "32" | `--[dendrogram w/ 2 branches and 6 members at h = 31.6] | |--[dendrogram w/ 2 branches and 2 members at h = 10.3] | | |--leaf "56" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 4 members at h = 29.3] | |--leaf "47" | `--[dendrogram w/ 2 branches and 3 members at h = 9.65] | |--leaf "62" | `--[dendrogram w/ 2 branches and 2 members at h = 5.44] | |--leaf "63" | `--leaf "64" `--[dendrogram w/ 2 branches and 25 members at h = 151] |--[dendrogram w/ 2 branches and 11 members at h = 41.1] | |--[dendrogram w/ 2 branches and 4 members at h = 16.0] | | |--[dendrogram w/ 2 branches and 2 members at h = 9.58] | | | |--leaf "46" | | | `--leaf "51" | | `--[dendrogram w/ 2 branches and 2 members at h = 9.8] | | |--leaf "57" | | `--leaf "73" | `--[dendrogram w/ 2 branches and 7 members at h = 29.6] | |--[dendrogram w/ 2 branches and 2 members at h = 6.88] | | |--leaf "26" | | `--leaf "27" | `--[dendrogram w/ 2 branches and 5 members at h = 15.8] | |--[dendrogram w/ 2 branches and 2 members at h = 3.92] | | |--leaf "23" | | `--leaf "54" | `--[dendrogram w/ 2 branches and 3 members at h = 12.8] | |--leaf "40" | `--[dendrogram w/ 2 branches and 2 members at h = 10.2] | |--leaf "29" | `--leaf "33" `--[dendrogram w/ 2 branches and 14 members at h = 91.4] |--[dendrogram w/ 2 branches and 7 members at h = 42.6] | |--[dendrogram w/ 2 branches and 3 members at h = 11.8] | | |--leaf "38" | | `--[dendrogram w/ 2 branches and 2 members at h = 9.2] | | |--leaf "35" | | `--leaf "50" | `--[dendrogram w/ 2 branches and 4 members at h = 24.7] | |--leaf "44" | `--[dendrogram w/ 2 branches and 3 members at h = 14.5] | |--leaf "39" | `--[dendrogram w/ 2 branches and 2 members at h = 9.5] | |--leaf "11" | `--leaf "55" `--[dendrogram w/ 2 branches and 7 members at h = 44.6] |--leaf "72" `--[dendrogram w/ 2 branches and 6 members at h = 21.2] |--[dendrogram w/ 2 branches and 4 members at h = 13.7] | |--leaf "52" | `--[dendrogram w/ 2 branches and 3 members at h = 12.3] | |--leaf "69" | `--[dendrogram w/ 2 branches and 2 members at h = 9.65] | |--leaf "66" | `--leaf "67" `--[dendrogram w/ 2 branches and 2 members at h = 17.8] |--leaf "58" `--leaf "70" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1jhhp1226513207.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/2ms5z1226513207.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/3xytb1226513208.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/4vj091226513208.tab") + } > > system("convert tmp/1jhhp1226513207.ps tmp/1jhhp1226513207.png") > system("convert tmp/2ms5z1226513207.ps tmp/2ms5z1226513207.png") convert: unable to open image `tmp/2ms5z1226513207.ps': No such file or directory. convert: missing an image filename `tmp/2ms5z1226513207.png'. > > > proc.time() user system elapsed 0.904 0.199 1.121