R version 2.8.0 (2008-10-20) 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(118.4 + ,111.4 + ,104.0 + ,121.4 + ,114.1 + ,107.9 + ,128.8 + ,121.8 + ,113.8 + ,131.7 + ,127.6 + ,113.8 + ,141.7 + ,129.9 + ,123.1 + ,142.9 + ,128.0 + ,125.1 + ,139.4 + ,123.5 + ,137.6 + ,134.7 + ,124.0 + ,134.0 + ,125.0 + ,127.4 + ,140.3 + ,113.6 + ,127.6 + ,152.1 + ,111.5 + ,128.4 + ,150.6 + ,108.5 + ,131.4 + ,167.3 + ,112.3 + ,135.1 + ,153.2 + ,116.6 + ,134.0 + ,142.0 + ,115.5 + ,144.5 + ,154.4 + ,120.1 + ,147.3 + ,158.5 + ,132.9 + ,150.9 + ,180.9 + ,128.1 + ,148.7 + ,181.3 + ,129.3 + ,141.4 + ,172.4 + ,132.5 + ,138.9 + ,192.0 + ,131.0 + ,139.8 + ,199.3 + ,124.9 + ,145.6 + ,215.4 + ,120.8 + ,147.9 + ,214.3 + ,122.0 + ,148.5 + ,201.5 + ,122.1 + ,151.1 + ,190.5 + ,127.4 + ,157.5 + ,196.0 + ,135.2 + ,167.5 + ,215.7 + ,137.3 + ,172.3 + ,209.4 + ,135.0 + ,173.5 + ,214.1 + ,136.0 + ,187.5 + ,237.8 + ,138.4 + ,205.5 + ,239.0 + ,134.7 + ,195.1 + ,237.8 + ,138.4 + ,204.5 + ,251.5 + ,133.9 + ,204.5 + ,248.8 + ,133.6 + ,201.7 + ,215.4 + ,141.2 + ,207.0 + ,201.2 + ,151.8 + ,206.6 + ,203.1 + ,155.4 + ,210.6 + ,214.2 + ,156.6 + ,211.1 + ,188.9 + ,161.6 + ,215.0 + ,203.0 + ,160.7 + ,223.9 + ,213.3 + ,156.0 + ,238.2 + ,228.5 + ,159.5 + ,238.9 + ,228.2 + ,168.7 + ,229.6 + ,240.9 + ,169.9 + ,232.2 + ,258.8 + ,169.9 + ,222.1 + ,248.5 + ,185.9 + ,221.6 + ,269.2 + ,190.8 + ,227.3 + ,289.6 + ,195.8 + ,221.0 + ,323.4 + ,211.9 + ,213.6 + ,317.2 + ,227.1 + ,243.4 + ,322.8 + ,251.3 + ,253.8 + ,340.9 + ,256.7 + ,265.3 + ,368.2 + ,251.9 + ,268.2 + ,388.5 + ,251.2 + ,268.5 + ,441.2 + ,270.3 + ,266.9 + ,474.3 + ,267.2 + ,268.4 + ,483.9 + ,243.0 + ,250.8 + ,417.9 + ,229.9 + ,231.2 + ,365.9 + ,187.2 + ,192.0 + ,263.0) + ,dim=c(3 + ,60) + ,dimnames=list(c('PIC_levensmiddelen' + ,'PIC_industriële_grondstoffen' + ,'PIC_energiegrondstoffen') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('PIC_levensmiddelen','PIC_industriële_grondstoffen','PIC_energiegrondstoffen'),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 = 2863] |--[dendrogram w/ 2 branches and 14 members at h = 531] | |--[dendrogram w/ 2 branches and 4 members at h = 90.2] | | |--[dendrogram w/ 2 branches and 2 members at h = 10.2] | | | |--leaf "56" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 2 members at h = 30.4] | | |--leaf "55" | | `--leaf "58" | `--[dendrogram w/ 2 branches and 10 members at h = 289] | |--[dendrogram w/ 2 branches and 5 members at h = 78.2] | | |--[dendrogram w/ 2 branches and 2 members at h = 21.1] | | | |--leaf "53" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 3 members at h = 45.9] | | |--leaf "59" | | `--[dendrogram w/ 2 branches and 2 members at h = 32.0] | | |--leaf "51" | | `--leaf "52" | `--[dendrogram w/ 2 branches and 5 members at h = 88.3] | |--[dendrogram w/ 2 branches and 2 members at h = 18.8] | | |--leaf "49" | | `--leaf "50" | `--[dendrogram w/ 2 branches and 3 members at h = 42.5] | |--leaf "60" | `--[dendrogram w/ 2 branches and 2 members at h = 21.7] | |--leaf "47" | `--leaf "48" `--[dendrogram w/ 2 branches and 46 members at h = 1370] |--[dendrogram w/ 2 branches and 17 members at h = 175] | |--[dendrogram w/ 2 branches and 7 members at h = 37.4] | | |--[dendrogram w/ 2 branches and 3 members at h = 14.1] | | | |--leaf "41" | | | `--[dendrogram w/ 2 branches and 2 members at h = 13.5] | | | |--leaf "38" | | | `--leaf "40" | | `--[dendrogram w/ 2 branches and 4 members at h = 30.1] | | |--leaf "35" | | `--[dendrogram w/ 2 branches and 3 members at h = 20.3] | | |--leaf "39" | | `--[dendrogram w/ 2 branches and 2 members at h = 10.8] | | |--leaf "36" | | `--leaf "37" | `--[dendrogram w/ 2 branches and 10 members at h = 162] | |--[dendrogram w/ 2 branches and 5 members at h = 29] | | |--[dendrogram w/ 2 branches and 2 members at h = 7.71] | | | |--leaf "30" | | | `--leaf "32" | | `--[dendrogram w/ 2 branches and 3 members at h = 13.8] | | |--leaf "31" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.25] | | |--leaf "33" | | `--leaf "34" | `--[dendrogram w/ 2 branches and 5 members at h = 51.2] | |--[dendrogram w/ 2 branches and 2 members at h = 3.58] | | |--leaf "42" | | `--leaf "43" | `--[dendrogram w/ 2 branches and 3 members at h = 18.1] | |--leaf "45" | `--[dendrogram w/ 2 branches and 2 members at h = 10.7] | |--leaf "44" | `--leaf "46" `--[dendrogram w/ 2 branches and 29 members at h = 623] |--[dendrogram w/ 2 branches and 13 members at h = 106] | |--[dendrogram w/ 2 branches and 3 members at h = 7.82] | | |--leaf "27" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.37] | | |--leaf "28" | | `--leaf "29" | `--[dendrogram w/ 2 branches and 10 members at h = 61.8] | |--[dendrogram w/ 2 branches and 3 members at h = 14.8] | | |--leaf "19" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.3] | | |--leaf "17" | | `--leaf "18" | `--[dendrogram w/ 2 branches and 7 members at h = 40.9] | |--[dendrogram w/ 2 branches and 2 members at h = 4.83] | | |--leaf "22" | | `--leaf "23" | `--[dendrogram w/ 2 branches and 5 members at h = 27] | |--[dendrogram w/ 2 branches and 2 members at h = 7.5] | | |--leaf "20" | | `--leaf "21" | `--[dendrogram w/ 2 branches and 3 members at h = 12.1] | |--leaf "24" | `--[dendrogram w/ 2 branches and 2 members at h = 9.96] | |--leaf "25" | `--leaf "26" `--[dendrogram w/ 2 branches and 16 members at h = 200] |--[dendrogram w/ 2 branches and 8 members at h = 34.7] | |--[dendrogram w/ 2 branches and 2 members at h = 6.77] | | |--leaf "15" | | `--leaf "16" | `--[dendrogram w/ 2 branches and 6 members at h = 30.9] | |--[dendrogram w/ 2 branches and 2 members at h = 10.8] | | |--leaf "9" | | `--leaf "14" | `--[dendrogram w/ 2 branches and 4 members at h = 21.4] | |--leaf "12" | `--[dendrogram w/ 2 branches and 3 members at h = 9.05] | |--leaf "13" | `--[dendrogram w/ 2 branches and 2 members at h = 2.7] | |--leaf "10" | `--leaf "11" `--[dendrogram w/ 2 branches and 8 members at h = 72.1] |--[dendrogram w/ 2 branches and 4 members at h = 23.9] | |--[dendrogram w/ 2 branches and 2 members at h = 3.01] | | |--leaf "5" | | `--leaf "6" | `--[dendrogram w/ 2 branches and 2 members at h = 5.94] | |--leaf "7" | `--leaf "8" `--[dendrogram w/ 2 branches and 4 members at h = 29.4] |--[dendrogram w/ 2 branches and 2 members at h = 5.61] | |--leaf "1" | `--leaf "2" `--[dendrogram w/ 2 branches and 2 members at h = 6.48] |--leaf "3" `--leaf "4" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/1jdj31226568374.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/freestat/rcomp/tmp/2wh0h1226568374.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/3rx1j1226568375.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/freestat/rcomp/tmp/4lr0w1226568375.tab") + } > > system("convert tmp/1jdj31226568374.ps tmp/1jdj31226568374.png") > system("convert tmp/2wh0h1226568374.ps tmp/2wh0h1226568374.png") convert: unable to open image `tmp/2wh0h1226568374.ps': No such file or directory. convert: missing an image filename `tmp/2wh0h1226568374.png'. > > > proc.time() user system elapsed 0.794 0.255 0.854