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(124.1,188.5,124.4,188.6,115.7,191.9,108.3,193.5,102.3,194.9,104.6,194.9,104,196.2,103.5,196.2,96,198,96.6,198.6,95.4,201.3,92.1,203.5,93,204.1,90.4,204.8,93.3,206.5,97.1,207.8,111,208.6,114.1,209.7,113.3,210,111,211.7,107.2,212.4,118.3,213.7,134.1,214.8,139,216.4,116.7,217.5,112.5,218.6,122.8,220.4,130,221.8,125.6,222.5,123.8,223.4,135.8,225.5,136.4,226.5,135.3,227.8,149.5,228.5,159.6,229.1,161.4,229.9,175.2,230.8,199.5,231.9,245,236,257.8,237.5),dim=c(2,40),dimnames=list(c('Prijsindexcijfer','Uurlonen'),1:40)) > y <- array(NA,dim=c(2,40),dimnames=list(c('Prijsindexcijfer','Uurlonen'),1:40)) > 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 40 members at h = 589] |--[dendrogram w/ 2 branches and 7 members at h = 200] | |--[dendrogram w/ 2 branches and 2 members at h = 12.9] | | |--leaf "39" | | `--leaf "40" | `--[dendrogram w/ 2 branches and 5 members at h = 53.1] | |--leaf "38" | `--[dendrogram w/ 2 branches and 4 members at h = 23.7] | |--leaf "37" | `--[dendrogram w/ 2 branches and 3 members at h = 14.1] | |--leaf "34" | `--[dendrogram w/ 2 branches and 2 members at h = 1.97] | |--leaf "35" | `--leaf "36" `--[dendrogram w/ 2 branches and 33 members at h = 285] |--[dendrogram w/ 2 branches and 16 members at h = 99.3] | |--[dendrogram w/ 2 branches and 8 members at h = 18] | | |--[dendrogram w/ 2 branches and 3 members at h = 3.92] | | | |--leaf "11" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.849] | | | |--leaf "9" | | | `--leaf "10" | | `--[dendrogram w/ 2 branches and 5 members at h = 7.9] | | |--leaf "16" | | `--[dendrogram w/ 2 branches and 4 members at h = 3.52] | | |--leaf "15" | | `--[dendrogram w/ 2 branches and 3 members at h = 2.86] | | |--leaf "14" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.08] | | |--leaf "12" | | `--leaf "13" | `--[dendrogram w/ 2 branches and 8 members at h = 54.2] | |--[dendrogram w/ 2 branches and 5 members at h = 7.3] | | |--leaf "4" | | `--[dendrogram w/ 2 branches and 4 members at h = 2.5] | | |--leaf "5" | | `--[dendrogram w/ 2 branches and 3 members at h = 1.92] | | |--leaf "6" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.5] | | |--leaf "7" | | `--leaf "8" | `--[dendrogram w/ 2 branches and 3 members at h = 12.1] | |--leaf "3" | `--[dendrogram w/ 2 branches and 2 members at h = 0.316] | |--leaf "1" | `--leaf "2" `--[dendrogram w/ 2 branches and 17 members at h = 120] |--[dendrogram w/ 2 branches and 8 members at h = 19.5] | |--[dendrogram w/ 2 branches and 3 members at h = 6.58] | | |--leaf "26" | | `--[dendrogram w/ 2 branches and 2 members at h = 4.12] | | |--leaf "22" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 5 members at h = 7.63] | |--leaf "21" | `--[dendrogram w/ 2 branches and 4 members at h = 4.29] | |--[dendrogram w/ 2 branches and 2 members at h = 0.854] | | |--leaf "18" | | `--leaf "19" | `--[dendrogram w/ 2 branches and 2 members at h = 3.1] | |--leaf "17" | `--leaf "20" `--[dendrogram w/ 2 branches and 9 members at h = 32.2] |--[dendrogram w/ 2 branches and 4 members at h = 7.65] | |--leaf "28" | `--[dendrogram w/ 2 branches and 3 members at h = 3.77] | |--leaf "27" | `--[dendrogram w/ 2 branches and 2 members at h = 2.01] | |--leaf "29" | `--leaf "30" `--[dendrogram w/ 2 branches and 5 members at h = 22.7] |--[dendrogram w/ 2 branches and 3 members at h = 2.32] | |--leaf "33" | `--[dendrogram w/ 2 branches and 2 members at h = 1.17] | |--leaf "31" | `--leaf "32" `--[dendrogram w/ 2 branches and 2 members at h = 5.15] |--leaf "23" `--leaf "24" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/1seuz1229503198.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/28jjy1229503198.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/3255l1229503198.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/4xnu01229503198.tab") + } > > system("convert tmp/1seuz1229503198.ps tmp/1seuz1229503198.png") > system("convert tmp/28jjy1229503198.ps tmp/28jjy1229503198.png") convert: unable to open image `tmp/28jjy1229503198.ps': No such file or directory. convert: missing an image filename `tmp/28jjy1229503198.png'. > > > proc.time() user system elapsed 0.722 0.245 0.864