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(109.8 + ,148.8 + ,118.3 + ,110.3 + ,111.7 + ,146.7 + ,127.3 + ,114.8 + ,98.6 + ,118.8 + ,112.3 + ,94.6 + ,96.9 + ,99.4 + ,114.9 + ,92 + ,95.1 + ,97.6 + ,108.2 + ,93.8 + ,97 + ,110.2 + ,105.4 + ,93.8 + ,112.7 + ,146.6 + ,122.1 + ,107.6 + ,102.9 + ,136.4 + ,113.5 + ,101 + ,97.4 + ,126.2 + ,110 + ,95.4 + ,111.4 + ,154.9 + ,125.3 + ,96.5 + ,87.4 + ,109 + ,114.3 + ,89.2 + ,96.8 + ,128.5 + ,115.6 + ,87.1 + ,114.1 + ,144.9 + ,127.1 + ,110.5 + ,110.3 + ,136.3 + ,123 + ,110.8 + ,103.9 + ,134.8 + ,122.2 + ,104.2 + ,101.6 + ,103.4 + ,126.4 + ,88.9 + ,94.6 + ,106.6 + ,112.7 + ,89.8 + ,95.9 + ,119.2 + ,105.8 + ,90 + ,104.7 + ,149.3 + ,120.9 + ,93.9 + ,102.8 + ,150.2 + ,116.3 + ,91.3 + ,98.1 + ,142.9 + ,115.7 + ,87.8 + ,113.9 + ,163.6 + ,127.9 + ,99.7 + ,80.9 + ,98.2 + ,108.3 + ,73.5 + ,95.7 + ,138.2 + ,121.1 + ,79.2 + ,113.2 + ,143.7 + ,128.6 + ,96.9 + ,105.9 + ,132.8 + ,123.1 + ,95.2 + ,108.8 + ,149.4 + ,127.7 + ,95.6 + ,102.3 + ,128.8 + ,126.6 + ,89.7 + ,99 + ,98.9 + ,118.4 + ,92.8 + ,100.7 + ,106.2 + ,110 + ,88 + ,115.5 + ,140.7 + ,129.6 + ,101.1 + ,100.7 + ,133 + ,115.8 + ,92.7 + ,109.9 + ,156.4 + ,125.9 + ,95.8 + ,114.6 + ,157.7 + ,128.4 + ,103.8 + ,85.4 + ,107.9 + ,114 + ,81.8 + ,100.5 + ,133.6 + ,125.6 + ,87.1 + ,114.8 + ,148.1 + ,128.5 + ,105.9 + ,116.5 + ,205.6 + ,136.6 + ,108.1 + ,112.9 + ,193.1 + ,133.1 + ,102.6 + ,102 + ,117.5 + ,124.6 + ,93.7 + ,106 + ,116.4 + ,123.5 + ,103.5 + ,105.3 + ,129.5 + ,117.2 + ,100.6 + ,118.8 + ,157.1 + ,135.5 + ,113.3 + ,106.1 + ,157 + ,124.8 + ,102.4 + ,109.3 + ,158.4 + ,127.8 + ,102.1 + ,117.2 + ,161.7 + ,133.1 + ,106.9 + ,92.5 + ,116.9 + ,125.7 + ,87.3 + ,104.2 + ,161.1 + ,128.4 + ,93.1 + ,112.5 + ,155.7 + ,131.9 + ,109.1 + ,122.4 + ,160.8 + ,146.3 + ,120.3 + ,113.3 + ,145.4 + ,140.6 + ,104.9 + ,100 + ,111 + ,129.5 + ,92.6 + ,110.7 + ,144.8 + ,132.4 + ,109.8 + ,112.8 + ,149.2 + ,125.9 + ,111.4 + ,109.8 + ,156.6 + ,126.9 + ,117.9 + ,117.3 + ,182.5 + ,135.8 + ,121.6 + ,109.1 + ,171.3 + ,129.5 + ,117.8 + ,115.9 + ,172.7 + ,130.2 + ,124.2 + ,96 + ,133 + ,133.8 + ,106.8 + ,97.6 + ,148.1 + ,123.3 + ,100.9) + ,dim=c(4 + ,60) + ,dimnames=list(c('Totaal' + ,'Delfstoffen' + ,'Voeding' + ,'Metaal') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('Totaal','Delfstoffen','Voeding','Metaal'),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 = 659] |--[dendrogram w/ 2 branches and 17 members at h = 68.6] | |--[dendrogram w/ 2 branches and 9 members at h = 39.6] | | |--[dendrogram w/ 2 branches and 6 members at h = 20.3] | | | |--[dendrogram w/ 2 branches and 3 members at h = 10.1] | | | | |--leaf "6" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 6.92] | | | | |--leaf "17" | | | | `--leaf "30" | | | `--[dendrogram w/ 2 branches and 3 members at h = 10.9] | | | |--leaf "5" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.19] | | | |--leaf "4" | | | `--leaf "29" | | `--[dendrogram w/ 2 branches and 3 members at h = 21.2] | | |--leaf "23" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.75] | | |--leaf "11" | | `--leaf "35" | `--[dendrogram w/ 2 branches and 8 members at h = 47.4] | |--[dendrogram w/ 2 branches and 3 members at h = 9.59] | | |--leaf "18" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.88] | | |--leaf "3" | | `--leaf "9" | `--[dendrogram w/ 2 branches and 5 members at h = 19.6] | |--leaf "41" | `--[dendrogram w/ 2 branches and 4 members at h = 15] | |--leaf "16" | `--[dendrogram w/ 2 branches and 3 members at h = 12.6] | |--leaf "47" | `--[dendrogram w/ 2 branches and 2 members at h = 8.45] | |--leaf "40" | `--leaf "52" `--[dendrogram w/ 2 branches and 43 members at h = 247] |--[dendrogram w/ 2 branches and 11 members at h = 88] | |--[dendrogram w/ 2 branches and 2 members at h = 14.6] | | |--leaf "38" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 9 members at h = 51.4] | |--[dendrogram w/ 2 branches and 3 members at h = 15.1] | | |--leaf "56" | | `--[dendrogram w/ 2 branches and 2 members at h = 9.47] | | |--leaf "57" | | `--leaf "58" | `--[dendrogram w/ 2 branches and 6 members at h = 27.6] | |--leaf "50" | `--[dendrogram w/ 2 branches and 5 members at h = 16.5] | |--leaf "55" | `--[dendrogram w/ 2 branches and 4 members at h = 11.0] | |--leaf "43" | `--[dendrogram w/ 2 branches and 3 members at h = 7.94] | |--leaf "46" | `--[dendrogram w/ 2 branches and 2 members at h = 6.98] | |--leaf "34" | `--leaf "49" `--[dendrogram w/ 2 branches and 32 members at h = 161] |--[dendrogram w/ 2 branches and 11 members at h = 40.8] | |--[dendrogram w/ 2 branches and 7 members at h = 23.3] | | |--[dendrogram w/ 2 branches and 2 members at h = 11.4] | | | |--leaf "21" | | | `--leaf "24" | | `--[dendrogram w/ 2 branches and 5 members at h = 17.4] | | |--[dendrogram w/ 2 branches and 2 members at h = 8.18] | | | |--leaf "12" | | | `--leaf "32" | | `--[dendrogram w/ 2 branches and 3 members at h = 10.4] | | |--leaf "26" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.83] | | |--leaf "28" | | `--leaf "36" | `--[dendrogram w/ 2 branches and 4 members at h = 24.3] | |--leaf "59" | `--[dendrogram w/ 2 branches and 3 members at h = 9.07] | |--leaf "15" | `--[dendrogram w/ 2 branches and 2 members at h = 8.2] | |--leaf "8" | `--leaf "42" `--[dendrogram w/ 2 branches and 21 members at h = 90.1] |--[dendrogram w/ 2 branches and 11 members at h = 31.4] | |--[dendrogram w/ 2 branches and 3 members at h = 16.3] | | |--leaf "51" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.74] | | |--leaf "25" | | `--leaf "31" | `--[dendrogram w/ 2 branches and 8 members at h = 17] | |--[dendrogram w/ 2 branches and 5 members at h = 9.14] | | |--[dendrogram w/ 2 branches and 3 members at h = 5.13] | | | |--leaf "13" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.58] | | | |--leaf "2" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.62] | | |--leaf "37" | | `--leaf "53" | `--[dendrogram w/ 2 branches and 3 members at h = 14.3] | |--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 5.91] | |--leaf "1" | `--leaf "7" `--[dendrogram w/ 2 branches and 10 members at h = 33.8] |--[dendrogram w/ 2 branches and 3 members at h = 13.7] | |--leaf "60" | `--[dendrogram w/ 2 branches and 2 members at h = 5.69] | |--leaf "19" | `--leaf "20" `--[dendrogram w/ 2 branches and 7 members at h = 15.6] |--[dendrogram w/ 2 branches and 3 members at h = 8.5] | |--leaf "27" | `--[dendrogram w/ 2 branches and 2 members at h = 2.31] | |--leaf "10" | `--leaf "33" `--[dendrogram w/ 2 branches and 4 members at h = 13] |--leaf "48" `--[dendrogram w/ 2 branches and 3 members at h = 10.7] |--leaf "22" `--[dendrogram w/ 2 branches and 2 members at h = 4.61] |--leaf "44" `--leaf "45" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1p5mu1226148403.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/2riv51226148403.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/3ubku1226148403.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/4nl4p1226148403.tab") + } > > system("convert tmp/1p5mu1226148403.ps tmp/1p5mu1226148403.png") > system("convert tmp/2riv51226148403.ps tmp/2riv51226148403.png") convert: unable to open image `tmp/2riv51226148403.ps': No such file or directory. convert: missing an image filename `tmp/2riv51226148403.png'. > > > proc.time() user system elapsed 0.821 0.208 0.978