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(15 + ,15.1 + ,467 + ,98.6 + ,14.9 + ,14.8 + ,460 + ,98 + ,16.8 + ,16.1 + ,448 + ,106.8 + ,14.3 + ,14.3 + ,443 + ,96.7 + ,15.5 + ,15.2 + ,436 + ,100.2 + ,15.6 + ,14.9 + ,431 + ,107.7 + ,14.6 + ,13.1 + ,484 + ,92 + ,12.5 + ,12.6 + ,510 + ,98.4 + ,14.8 + ,13.6 + ,513 + ,107.4 + ,15.9 + ,14.4 + ,503 + ,117.7 + ,14.8 + ,14 + ,471 + ,105.7 + ,12.9 + ,12.9 + ,471 + ,97.5 + ,14.3 + ,13.4 + ,476 + ,99.9 + ,14.2 + ,13.5 + ,475 + ,98.2 + ,15.9 + ,14.8 + ,470 + ,104.5 + ,15.3 + ,14.3 + ,461 + ,100.8 + ,15.5 + ,14.3 + ,455 + ,101.5 + ,15.1 + ,14 + ,456 + ,103.9 + ,15 + ,13.2 + ,517 + ,99.6 + ,12.1 + ,12.2 + ,525 + ,98.4 + ,15.8 + ,14.3 + ,523 + ,112.7 + ,16.9 + ,15.7 + ,519 + ,118.4 + ,15.1 + ,14.2 + ,509 + ,108.1 + ,13.7 + ,14.6 + ,512 + ,105.4 + ,14.8 + ,14.5 + ,519 + ,114.6 + ,14.7 + ,14.3 + ,517 + ,106.9 + ,16 + ,15.3 + ,510 + ,115.9 + ,15.4 + ,14.4 + ,509 + ,109.8 + ,15 + ,13.7 + ,501 + ,101.8 + ,15.5 + ,14.2 + ,507 + ,114.2 + ,15.1 + ,13.5 + ,569 + ,110.8 + ,11.7 + ,11.9 + ,580 + ,108.4 + ,16.3 + ,14.6 + ,578 + ,127.5 + ,16.7 + ,15.6 + ,565 + ,128.6 + ,15 + ,14.1 + ,547 + ,116.6 + ,14.9 + ,14.9 + ,555 + ,127.4 + ,14.6 + ,14.2 + ,562 + ,105 + ,15.3 + ,14.6 + ,561 + ,108.3 + ,17.9 + ,17.2 + ,555 + ,125 + ,16.4 + ,15.4 + ,544 + ,111.6 + ,15.4 + ,14.3 + ,537 + ,106.5 + ,17.9 + ,17.5 + ,543 + ,130.3 + ,15.9 + ,14.5 + ,594 + ,115 + ,13.9 + ,14.4 + ,611 + ,116.1 + ,17.8 + ,16.6 + ,613 + ,134 + ,17.9 + ,16.7 + ,611 + ,126.5 + ,17.4 + ,16.6 + ,594 + ,125.8 + ,16.7 + ,16.9 + ,595 + ,136.4 + ,16 + ,15.7 + ,591 + ,114.9 + ,16.6 + ,16.4 + ,589 + ,110.9 + ,19.1 + ,18.4 + ,584 + ,125.5 + ,17.8 + ,16.9 + ,573 + ,116.8 + ,17.2 + ,16.5 + ,567 + ,116.8 + ,18.6 + ,18.3 + ,569 + ,125.5 + ,16.3 + ,15.1 + ,621 + ,104.2 + ,15.1 + ,15.7 + ,629 + ,115.1 + ,19.2 + ,18.1 + ,628 + ,132.8 + ,17.7 + ,16.8 + ,612 + ,123.3 + ,19.1 + ,18.9 + ,595 + ,124.8 + ,18 + ,19 + ,597 + ,122 + ,17.5 + ,18.1 + ,593 + ,117.4 + ,17.8 + ,17.8 + ,590 + ,117.9 + ,21.1 + ,21.5 + ,580 + ,137.4 + ,17.2 + ,17.1 + ,574 + ,114.6 + ,19.4 + ,18.7 + ,573 + ,124.7 + ,19.8 + ,19 + ,573 + ,129.6 + ,17.6 + ,16.4 + ,620 + ,109.4 + ,16.2 + ,16.9 + ,626 + ,120.9 + ,19.5 + ,18.6 + ,620 + ,134.9 + ,19.9 + ,19.3 + ,588 + ,136.3 + ,20 + ,19.4 + ,566 + ,133.2 + ,17.3 + ,17.6 + ,557 + ,127.2) + ,dim=c(4 + ,72) + ,dimnames=list(c('Uitvoer' + ,'Invoer' + ,'Werkloosheid' + ,'Niet_duurzame_consumptiegoederen') + ,1:72)) > y <- array(NA,dim=c(4,72),dimnames=list(c('Uitvoer','Invoer','Werkloosheid','Niet_duurzame_consumptiegoederen'),1:72)) > 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 72 members at h = 2320] |--[dendrogram w/ 2 branches and 42 members at h = 435] | |--[dendrogram w/ 2 branches and 10 members at h = 51.7] | | |--[dendrogram w/ 2 branches and 4 members at h = 21.4] | | | |--[dendrogram w/ 2 branches and 2 members at h = 5.6] | | | | |--leaf "55" | | | | `--leaf "67" | | | `--[dendrogram w/ 2 branches and 2 members at h = 6.73] | | | |--leaf "56" | | | `--leaf "68" | | `--[dendrogram w/ 2 branches and 6 members at h = 31.1] | | |--[dendrogram w/ 2 branches and 3 members at h = 12.2] | | | |--leaf "44" | | | `--[dendrogram w/ 2 branches and 2 members at h = 3.36] | | | |--leaf "46" | | | `--leaf "58" | | `--[dendrogram w/ 2 branches and 3 members at h = 13.1] | | |--leaf "57" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.53] | | |--leaf "45" | | `--leaf "69" | `--[dendrogram w/ 2 branches and 32 members at h = 202] | |--[dendrogram w/ 2 branches and 7 members at h = 46.2] | | |--[dendrogram w/ 2 branches and 3 members at h = 13.3] | | | |--leaf "41" | | | `--[dendrogram w/ 2 branches and 2 members at h = 6.14] | | | |--leaf "35" | | | `--leaf "40" | | `--[dendrogram w/ 2 branches and 4 members at h = 18.3] | | |--leaf "42" | | `--[dendrogram w/ 2 branches and 3 members at h = 4.72] | | |--leaf "36" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.06] | | |--leaf "39" | | `--leaf "72" | `--[dendrogram w/ 2 branches and 25 members at h = 126] | |--[dendrogram w/ 2 branches and 8 members at h = 26.6] | | |--[dendrogram w/ 2 branches and 3 members at h = 4.97] | | | |--leaf "60" | | | `--[dendrogram w/ 2 branches and 2 members at h = 3.19] | | | |--leaf "47" | | | `--leaf "59" | | `--[dendrogram w/ 2 branches and 5 members at h = 8.11] | | |--[dendrogram w/ 2 branches and 2 members at h = 3.07] | | | |--leaf "61" | | | `--leaf "62" | | `--[dendrogram w/ 2 branches and 3 members at h = 6.48] | | |--leaf "50" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.23] | | |--leaf "43" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 17 members at h = 98.2] | |--[dendrogram w/ 2 branches and 7 members at h = 27.5] | | |--[dendrogram w/ 2 branches and 2 members at h = 3.54] | | | |--leaf "37" | | | `--leaf "38" | | `--[dendrogram w/ 2 branches and 5 members at h = 17.6] | | |--leaf "32" | | `--[dendrogram w/ 2 branches and 4 members at h = 9.78] | | |--[dendrogram w/ 2 branches and 2 members at h = 2.5] | | | |--leaf "52" | | | `--leaf "64" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.31] | | |--leaf "31" | | `--leaf "53" | `--[dendrogram w/ 2 branches and 10 members at h = 49.1] | |--[dendrogram w/ 2 branches and 5 members at h = 12.9] | | |--[dendrogram w/ 2 branches and 3 members at h = 5.82] | | | |--leaf "66" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.18] | | | |--leaf "54" | | | `--leaf "65" | | `--[dendrogram w/ 2 branches and 2 members at h = 6.89] | | |--leaf "34" | | `--leaf "71" | `--[dendrogram w/ 2 branches and 5 members at h = 21.5] | |--[dendrogram w/ 2 branches and 2 members at h = 7.89] | | |--leaf "33" | | `--leaf "51" | `--[dendrogram w/ 2 branches and 3 members at h = 13.8] | |--leaf "63" | `--[dendrogram w/ 2 branches and 2 members at h = 8.06] | |--leaf "48" | `--leaf "70" `--[dendrogram w/ 2 branches and 30 members at h = 585] |--[dendrogram w/ 2 branches and 15 members at h = 43.4] | |--[dendrogram w/ 2 branches and 9 members at h = 25.2] | | |--[dendrogram w/ 2 branches and 3 members at h = 13.3] | | | |--leaf "20" | | | `--[dendrogram w/ 2 branches and 2 members at h = 7.55] | | | |--leaf "8" | | | `--leaf "19" | | `--[dendrogram w/ 2 branches and 6 members at h = 17.8] | | |--leaf "29" | | `--[dendrogram w/ 2 branches and 5 members at h = 9.9] | | |--[dendrogram w/ 2 branches and 2 members at h = 1.74] | | | |--leaf "23" | | | `--leaf "28" | | `--[dendrogram w/ 2 branches and 3 members at h = 5.38] | | |--leaf "26" | | `--[dendrogram w/ 2 branches and 2 members at h = 2.69] | | |--leaf "9" | | `--leaf "24" | `--[dendrogram w/ 2 branches and 6 members at h = 31.2] | |--[dendrogram w/ 2 branches and 3 members at h = 6.32] | | |--leaf "21" | | `--[dendrogram w/ 2 branches and 2 members at h = 4.5] | | |--leaf "22" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 3 members at h = 7.2] | |--leaf "10" | `--[dendrogram w/ 2 branches and 2 members at h = 3.65] | |--leaf "27" | `--leaf "30" `--[dendrogram w/ 2 branches and 15 members at h = 112] |--[dendrogram w/ 2 branches and 7 members at h = 21.7] | |--leaf "7" | `--[dendrogram w/ 2 branches and 6 members at h = 14.1] | |--[dendrogram w/ 2 branches and 2 members at h = 2.07] | | |--leaf "11" | | `--leaf "15" | `--[dendrogram w/ 2 branches and 4 members at h = 10.2] | |--[dendrogram w/ 2 branches and 2 members at h = 1.98] | | |--leaf "13" | | `--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 5.14] | |--leaf "1" | `--leaf "12" `--[dendrogram w/ 2 branches and 8 members at h = 51] |--[dendrogram w/ 2 branches and 4 members at h = 9.79] | |--[dendrogram w/ 2 branches and 2 members at h = 2.65] | | |--leaf "17" | | `--leaf "18" | `--[dendrogram w/ 2 branches and 2 members at h = 3.04] | |--leaf "2" | `--leaf "16" `--[dendrogram w/ 2 branches and 4 members at h = 15.7] |--leaf "3" `--[dendrogram w/ 2 branches and 3 members at h = 14.3] |--leaf "6" `--[dendrogram w/ 2 branches and 2 members at h = 7.97] |--leaf "4" `--leaf "5" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/1vu4e1226251128.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/2g6zu1226251128.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/3mrfn1226251128.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/4jogf1226251128.tab") + } > > system("convert tmp/1vu4e1226251128.ps tmp/1vu4e1226251128.png") > system("convert tmp/2g6zu1226251128.ps tmp/2g6zu1226251128.png") convert: unable to open image `tmp/2g6zu1226251128.ps': No such file or directory. convert: missing an image filename `tmp/2g6zu1226251128.png'. > > > proc.time() user system elapsed 1.178 0.280 1.317