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(4.8,19.2,3,5.5,26.6,3.5,5.4,26.6,3.9,5.9,31.4,4.4,5.8,31.2,3.5,5.1,26.4,4.7,4.1,20.7,1.6,4.4,20.7,2.3,3.6,15,1.2,3.5,13.3,1.4,3.1,8.7,2.7,2.9,10.2,1.5,2.2,4.3,2.1,1.4,-0.1,0.5,1.2,-4.6,1.7,1.3,-3.9,3.6,1.3,-3.5,3.2,1.3,-3.4,1.7,1.8,-2.5,5.6,1.8,-1.1,3.7,1.8,0.3,4.3,1.7,-0.9,5.9,2.1,3.6,4.8,2,2.7,6,1.7,-0.2,5.6,1.9,-1,6.7,2.3,5.8,3.3,2.4,6.4,3,2.5,9.6,1.6,2.8,13.2,1.7,2.6,10.6,1.1,2.2,10.9,-0.3,2.8,12.9,3,2.8,15.9,2.7,2.8,12.2,1.8,2.3,9.1,1.5,2.2,9,1,3,17.4,0.5,2.9,14.7,2.8,2.7,17,1.4,2.7,13.7,1.7,2.3,9.5,2.6,2.4,14.8,1.9,2.8,13.6,3.9,2.3,12.6,1.5,2,8.9,-0.5,1.9,10.2,1.9,2.3,12.7,1,2.7,16,0.1,1.8,10.4,-3.1,2,9.9,-0.8,2.1,9.5,0.7,2,8.6,1.4,2.4,10,2.8,1.7,3.5,1.9,1,-4.2,1.1,1.2,-4.4,1.4,1.4,-1.5,2.9,1.7,-0.1,2.9,1.8,0.8,2.9),dim=c(3,60),dimnames=list(c('Belgische_infaltie','Inflatie_Energiedragers','inflatie_onbewerkte_levensmiddelen'),1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('Belgische_infaltie','Inflatie_Energiedragers','inflatie_onbewerkte_levensmiddelen'),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 = 'single' > 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 = 6.12] |--[dendrogram w/ 2 branches and 55 members at h = 3.44] | |--[dendrogram w/ 2 branches and 3 members at h = 1.70] | | |--leaf "1" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.762] | | |--leaf "7" | | `--leaf "8" | `--[dendrogram w/ 2 branches and 52 members at h = 2.88] | |--[dendrogram w/ 2 branches and 16 members at h = 2.42] | | |--leaf "14" | | `--[dendrogram w/ 2 branches and 15 members at h = 2.02] | | |--[dendrogram w/ 2 branches and 6 members at h = 1.50] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.566] | | | | |--leaf "16" | | | | `--leaf "17" | | | `--[dendrogram w/ 2 branches and 4 members at h = 1.04] | | | |--leaf "18" | | | `--[dendrogram w/ 2 branches and 3 members at h = 0.412] | | | |--leaf "56" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.361] | | | |--leaf "15" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 9 members at h = 1.63] | | |--leaf "19" | | `--[dendrogram w/ 2 branches and 8 members at h = 1.46] | | |--[dendrogram w/ 2 branches and 4 members at h = 1.28] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.906] | | | | |--leaf "59" | | | | `--leaf "60" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.98] | | | |--leaf "20" | | | `--leaf "58" | | `--[dendrogram w/ 2 branches and 4 members at h = 1.40] | | |--leaf "21" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.83] | | |--leaf "26" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.762] | | |--leaf "22" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 36 members at h = 2.67] | |--[dendrogram w/ 2 branches and 2 members at h = 1.50] | | |--leaf "23" | | `--leaf "24" | `--[dendrogram w/ 2 branches and 34 members at h = 2.42] | |--[dendrogram w/ 2 branches and 4 members at h = 1.92] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.678] | | | |--leaf "27" | | | `--leaf "28" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.964] | | |--leaf "13" | | `--leaf "55" | `--[dendrogram w/ 2 branches and 30 members at h = 2.36] | |--leaf "50" | `--[dendrogram w/ 2 branches and 29 members at h = 1.76] | |--[dendrogram w/ 2 branches and 14 members at h = 1.35] | | |--[dendrogram w/ 2 branches and 3 members at h = 1.14] | | | |--leaf "32" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.04] | | | |--leaf "46" | | | `--leaf "51" | | `--[dendrogram w/ 2 branches and 11 members at h = 1.14] | | |--leaf "11" | | `--[dendrogram w/ 2 branches and 10 members at h = 1.02] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.548] | | | |--leaf "42" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 8 members at h = 0.9] | | |--leaf "47" | | `--[dendrogram w/ 2 branches and 7 members at h = 0.728] | | |--[dendrogram w/ 2 branches and 5 members at h = 0.592] | | | |--leaf "53" | | | `--[dendrogram w/ 2 branches and 4 members at h = 0.592] | | | |--leaf "52" | | | `--[dendrogram w/ 2 branches and 3 members at h = 0.548] | | | |--leaf "29" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.52] | | | |--leaf "36" | | | `--leaf "37" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.64] | | |--leaf "12" | | `--leaf "31" | `--[dendrogram w/ 2 branches and 15 members at h = 1.71] | |--[dendrogram w/ 2 branches and 12 members at h = 1.40] | | |--leaf "9" | | `--[dendrogram w/ 2 branches and 11 members at h = 1.33] | | |--[dendrogram w/ 2 branches and 2 members at h = 1.14] | | | |--leaf "33" | | | `--leaf "44" | | `--[dendrogram w/ 2 branches and 9 members at h = 1.21] | | |--leaf "34" | | `--[dendrogram w/ 2 branches and 8 members at h = 1.16] | | |--[dendrogram w/ 2 branches and 6 members at h = 0.806] | | | |--[dendrogram w/ 2 branches and 3 members at h = 0.707] | | | | |--leaf "35" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.51] | | | | |--leaf "45" | | | | `--leaf "48" | | | `--[dendrogram w/ 2 branches and 3 members at h = 0.768] | | | |--leaf "10" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.51] | | | |--leaf "30" | | | `--leaf "41" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.03] | | |--leaf "39" | | `--leaf "43" | `--[dendrogram w/ 2 branches and 3 members at h = 1.49] | |--leaf "49" | `--[dendrogram w/ 2 branches and 2 members at h = 1.03] | |--leaf "38" | `--leaf "40" `--[dendrogram w/ 2 branches and 5 members at h = 4.61] |--[dendrogram w/ 2 branches and 3 members at h = 0.877] | |--leaf "6" | `--[dendrogram w/ 2 branches and 2 members at h = 0.412] | |--leaf "2" | `--leaf "3" `--[dendrogram w/ 2 branches and 2 members at h = 0.927] |--leaf "4" `--leaf "5" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/11ik31226317573.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/24ex61226317573.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/3qc6j1226317573.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/4fq3c1226317573.tab") + } > > system("convert tmp/11ik31226317573.ps tmp/11ik31226317573.png") > system("convert tmp/24ex61226317573.ps tmp/24ex61226317573.png") convert: unable to open image `tmp/24ex61226317573.ps': No such file or directory. convert: missing an image filename `tmp/24ex61226317573.png'. > > > proc.time() user system elapsed 0.836 0.215 1.420