R version 2.7.0 (2008-04-22) 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(104.5 + ,104.3 + ,7.6 + ,87.4 + ,94.6 + ,8.2 + ,89.9 + ,90.4 + ,8.3 + ,109.8 + ,108.9 + ,8.4 + ,111.7 + ,111.4 + ,8.4 + ,98.6 + ,100.8 + ,8.4 + ,96.9 + ,102.5 + ,8.6 + ,95.1 + ,98.2 + ,8.9 + ,97 + ,98.7 + ,8.8 + ,112.7 + ,113.3 + ,8.3 + ,102.9 + ,104.6 + ,7.5 + ,97.4 + ,99.3 + ,7.2 + ,111.4 + ,111.8 + ,7.5 + ,87.4 + ,97.3 + ,8.8 + ,96.8 + ,97.7 + ,9.3 + ,114.1 + ,115.6 + ,9.3 + ,110.3 + ,111.9 + ,8.7 + ,103.9 + ,107 + ,8.2 + ,101.6 + ,107.1 + ,8.3 + ,94.6 + ,100.6 + ,8.5 + ,95.9 + ,99.2 + ,8.6 + ,104.7 + ,108.4 + ,8.6 + ,102.8 + ,103 + ,8.2 + ,98.1 + ,99.8 + ,8.1 + ,113.9 + ,115 + ,8 + ,80.9 + ,90.8 + ,8.6 + ,95.7 + ,95.9 + ,8.7 + ,113.2 + ,114.4 + ,8.8 + ,105.9 + ,108.2 + ,8.5 + ,108.8 + ,112.6 + ,8.4 + ,102.3 + ,109.1 + ,8.5 + ,99 + ,105 + ,8.7 + ,100.7 + ,105 + ,8.7 + ,115.5 + ,118.5 + ,8.6 + ,100.7 + ,103.7 + ,8.5 + ,109.9 + ,112.5 + ,8.3 + ,114.6 + ,116.6 + ,8.1 + ,85.4 + ,96.6 + ,8.2 + ,100.5 + ,101.9 + ,8.1 + ,114.8 + ,116.5 + ,8.1 + ,116.5 + ,119.3 + ,7.9 + ,112.9 + ,115.4 + ,7.9 + ,102 + ,108.5 + ,7.9 + ,106 + ,111.5 + ,8 + ,105.3 + ,108.8 + ,8 + ,118.8 + ,121.8 + ,7.9 + ,106.1 + ,109.6 + ,8 + ,109.3 + ,112.2 + ,7.7 + ,117.2 + ,119.6 + ,7.2 + ,92.5 + ,104.1 + ,7.5 + ,104.2 + ,105.3 + ,7.3 + ,112.5 + ,115 + ,7 + ,122.4 + ,124.1 + ,7 + ,113.3 + ,116.8 + ,7 + ,100 + ,107.5 + ,7.2 + ,110.7 + ,115.6 + ,7.3 + ,112.8 + ,116.2 + ,7.1 + ,109.8 + ,116.3 + ,6.8 + ,117.3 + ,119 + ,6.6 + ,109.1 + ,111.9 + ,6.2 + ,115.9 + ,118.6 + ,6.2) + ,dim=c(3 + ,61) + ,dimnames=list(c('TotIndustrie' + ,'TotIndustriezonderbouw' + ,'Werkloosheid') + ,1:61)) > y <- array(NA,dim=c(3,61),dimnames=list(c('TotIndustrie','TotIndustriezonderbouw','Werkloosheid'),1:61)) > 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 61 members at h = 314] |--[dendrogram w/ 2 branches and 16 members at h = 55.5] | |--[dendrogram w/ 2 branches and 11 members at h = 9.64] | | |--leaf "50" | | `--[dendrogram w/ 2 branches and 10 members at h = 7.96] | | |--[dendrogram w/ 2 branches and 5 members at h = 3.46] | | | |--leaf "27" | | | `--[dendrogram w/ 2 branches and 4 members at h = 2.22] | | | |--[dendrogram w/ 2 branches and 2 members at h = 1.14] | | | | |--leaf "9" | | | | `--leaf "15" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.32] | | | |--leaf "8" | | | `--leaf "21" | | `--[dendrogram w/ 2 branches and 5 members at h = 4.93] | | |--[dendrogram w/ 2 branches and 3 members at h = 1.95] | | | |--leaf "12" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.16] | | | |--leaf "6" | | | `--leaf "24" | | `--[dendrogram w/ 2 branches and 2 members at h = 2.98] | | |--leaf "7" | | `--leaf "20" | `--[dendrogram w/ 2 branches and 5 members at h = 10.5] | |--leaf "26" | `--[dendrogram w/ 2 branches and 4 members at h = 8.65] | |--leaf "3" | `--[dendrogram w/ 2 branches and 3 members at h = 3.00] | |--leaf "2" | `--[dendrogram w/ 2 branches and 2 members at h = 2.20] | |--leaf "14" | `--leaf "38" `--[dendrogram w/ 2 branches and 45 members at h = 178] |--[dendrogram w/ 2 branches and 19 members at h = 35.4] | |--[dendrogram w/ 2 branches and 12 members at h = 7.96] | | |--[dendrogram w/ 2 branches and 2 members at h = 1.24] | | | |--leaf "56" | | | `--leaf "58" | | `--[dendrogram w/ 2 branches and 10 members at h = 4.72] | | |--[dendrogram w/ 2 branches and 4 members at h = 2.43] | | | |--leaf "10" | | | `--[dendrogram w/ 2 branches and 3 members at h = 1.61] | | | |--leaf "16" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.22] | | | |--leaf "25" | | | `--leaf "28" | | `--[dendrogram w/ 2 branches and 6 members at h = 4.55] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.224] | | | |--leaf "37" | | | `--leaf "40" | | `--[dendrogram w/ 2 branches and 4 members at h = 2.10] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.787] | | | |--leaf "54" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.06] | | |--leaf "42" | | `--leaf "52" | `--[dendrogram w/ 2 branches and 7 members at h = 11.5] | |--[dendrogram w/ 2 branches and 5 members at h = 2.76] | | |--leaf "34" | | `--[dendrogram w/ 2 branches and 4 members at h = 2.11] | | |--leaf "61" | | `--[dendrogram w/ 2 branches and 3 members at h = 1.44] | | |--leaf "41" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.854] | | |--leaf "49" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 2 members at h = 4.37] | |--leaf "46" | `--leaf "53" `--[dendrogram w/ 2 branches and 26 members at h = 67] |--[dendrogram w/ 2 branches and 13 members at h = 12.2] | |--[dendrogram w/ 2 branches and 5 members at h = 4.3] | | |--[dendrogram w/ 2 branches and 3 members at h = 2.13] | | | |--leaf "32" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.32] | | | |--leaf "33" | | | `--leaf "35" | | `--[dendrogram w/ 2 branches and 2 members at h = 2.55] | | |--leaf "23" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 8 members at h = 9.96] | |--[dendrogram w/ 2 branches and 4 members at h = 3.03] | | |--leaf "18" | | `--[dendrogram w/ 2 branches and 3 members at h = 1.72] | | |--leaf "11" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.09] | | |--leaf "1" | | `--leaf "51" | `--[dendrogram w/ 2 branches and 4 members at h = 3.09] | |--[dendrogram w/ 2 branches and 2 members at h = 0.9] | | |--leaf "31" | | `--leaf "43" | `--[dendrogram w/ 2 branches and 2 members at h = 1.98] | |--leaf "19" | `--leaf "55" `--[dendrogram w/ 2 branches and 13 members at h = 21.9] |--[dendrogram w/ 2 branches and 5 members at h = 3.81] | |--leaf "44" | `--[dendrogram w/ 2 branches and 4 members at h = 1.76] | |--leaf "47" | `--[dendrogram w/ 2 branches and 3 members at h = 1.16] | |--leaf "29" | `--[dendrogram w/ 2 branches and 2 members at h = 0.938] | |--leaf "22" | `--leaf "45" `--[dendrogram w/ 2 branches and 8 members at h = 4.86] |--[dendrogram w/ 2 branches and 5 members at h = 2.90] | |--leaf "60" | `--[dendrogram w/ 2 branches and 4 members at h = 1.68] | |--[dendrogram w/ 2 branches and 2 members at h = 0.825] | | |--leaf "17" | | `--leaf "36" | `--[dendrogram w/ 2 branches and 2 members at h = 0.949] | |--leaf "30" | `--leaf "48" `--[dendrogram w/ 2 branches and 3 members at h = 4.04] |--leaf "4" `--[dendrogram w/ 2 branches and 2 members at h = 1.03] |--leaf "5" `--leaf "13" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/15qht1226314828.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/216ou1226314829.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/3m5y11226314829.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/42jdt1226314829.tab") + } > > system("convert tmp/15qht1226314828.ps tmp/15qht1226314828.png") > system("convert tmp/216ou1226314829.ps tmp/216ou1226314829.png") convert: unable to open image `tmp/216ou1226314829.ps': No such file or directory. convert: missing an image filename `tmp/216ou1226314829.png'. > > > proc.time() user system elapsed 1.546 0.306 1.620