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(519,127,392,517,123,394,510,118,392,509,114,396,501,108,392,507,111,396,569,151,419,580,159,421,578,158,420,565,148,418,547,138,410,555,137,418,562,136,426,561,133,428,555,126,430,544,120,424,537,114,423,543,116,427,594,153,441,611,162,449,613,161,452,611,149,462,594,139,455,595,135,461,591,130,461,589,127,463,584,122,462,573,117,456,567,112,455,569,113,456,621,149,472,629,157,472,628,157,471,612,147,465,595,137,459,597,132,465,593,125,468,590,123,467,580,117,463,574,114,460,573,111,462,573,112,461,620,144,476,626,150,476,620,149,471,588,134,453,566,123,443,557,116,442,561,117,444,549,111,438,532,105,427,526,102,424,511,95,416,499,93,406,555,124,431,565,130,434,542,124,418,527,115,412,510,106,404,514,105,409,517,105,412,508,101,406,493,95,398,490,93,397,469,84,385,478,87,390,528,116,413,534,120,413,518,117,401,506,109,397),dim=c(3,70),dimnames=list(c('totale_werkloosheid','werkloosheid_jonger_dan_25_jaar','werkloosheid_vanaf_25_jaar'),1:70)) > y <- array(NA,dim=c(3,70),dimnames=list(c('totale_werkloosheid','werkloosheid_jonger_dan_25_jaar','werkloosheid_vanaf_25_jaar'),1:70)) > 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 70 members at h = 1667] |--[dendrogram w/ 2 branches and 28 members at h = 386] | |--[dendrogram w/ 2 branches and 11 members at h = 87.6] | | |--[dendrogram w/ 2 branches and 3 members at h = 28.2] | | | |--leaf "19" | | | `--[dendrogram w/ 2 branches and 2 members at h = 3.74] | | | |--leaf "20" | | | `--leaf "21" | | `--[dendrogram w/ 2 branches and 8 members at h = 36.5] | | |--[dendrogram w/ 2 branches and 2 members at h = 3.74] | | | |--leaf "22" | | | `--leaf "34" | | `--[dendrogram w/ 2 branches and 6 members at h = 24.5] | | |--[dendrogram w/ 2 branches and 2 members at h = 1.41] | | | |--leaf "32" | | | `--leaf "33" | | `--[dendrogram w/ 2 branches and 4 members at h = 9] | | |--[dendrogram w/ 2 branches and 2 members at h = 1.41] | | | |--leaf "31" | | | `--leaf "45" | | `--[dendrogram w/ 2 branches and 2 members at h = 8.49] | | |--leaf "43" | | `--leaf "44" | `--[dendrogram w/ 2 branches and 17 members at h = 138] | |--[dendrogram w/ 2 branches and 6 members at h = 14.7] | | |--[dendrogram w/ 2 branches and 3 members at h = 3.66] | | | |--leaf "40" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.41] | | | |--leaf "41" | | | `--leaf "42" | | `--[dendrogram w/ 2 branches and 3 members at h = 8.2] | | |--leaf "28" | | `--[dendrogram w/ 2 branches and 2 members at h = 2.45] | | |--leaf "29" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 11 members at h = 42] | |--[dendrogram w/ 2 branches and 4 members at h = 11.8] | | |--leaf "46" | | `--[dendrogram w/ 2 branches and 3 members at h = 6.97] | | |--leaf "23" | | `--[dendrogram w/ 2 branches and 2 members at h = 2.83] | | |--leaf "24" | | `--leaf "35" | `--[dendrogram w/ 2 branches and 7 members at h = 25.4] | |--[dendrogram w/ 2 branches and 2 members at h = 6.48] | | |--leaf "27" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 5 members at h = 12.4] | |--[dendrogram w/ 2 branches and 2 members at h = 3.74] | | |--leaf "37" | | `--leaf "38" | `--[dendrogram w/ 2 branches and 3 members at h = 10.0] | |--leaf "36" | `--[dendrogram w/ 2 branches and 2 members at h = 4.12] | |--leaf "25" | `--leaf "26" `--[dendrogram w/ 2 branches and 42 members at h = 718] |--[dendrogram w/ 2 branches and 18 members at h = 145] | |--[dendrogram w/ 2 branches and 5 members at h = 48] | | |--[dendrogram w/ 2 branches and 2 members at h = 10.7] | | | |--leaf "65" | | | `--leaf "66" | | `--[dendrogram w/ 2 branches and 3 members at h = 14.0] | | |--leaf "54" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.74] | | |--leaf "63" | | `--leaf "64" | `--[dendrogram w/ 2 branches and 13 members at h = 74.7] | |--[dendrogram w/ 2 branches and 5 members at h = 16.7] | | |--leaf "53" | | `--[dendrogram w/ 2 branches and 4 members at h = 13.3] | | |--[dendrogram w/ 2 branches and 2 members at h = 4.24] | | | |--leaf "60" | | | `--leaf "61" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.74] | | |--leaf "59" | | `--leaf "62" | `--[dendrogram w/ 2 branches and 8 members at h = 39.1] | |--[dendrogram w/ 2 branches and 5 members at h = 11.9] | | |--leaf "5" | | `--[dendrogram w/ 2 branches and 4 members at h = 10.7] | | |--leaf "3" | | `--[dendrogram w/ 2 branches and 3 members at h = 5.53] | | |--leaf "4" | | `--[dendrogram w/ 2 branches and 2 members at h = 2.45] | | |--leaf "6" | | `--leaf "70" | `--[dendrogram w/ 2 branches and 3 members at h = 13.5] | |--leaf "69" | `--[dendrogram w/ 2 branches and 2 members at h = 4.9] | |--leaf "1" | `--leaf "2" `--[dendrogram w/ 2 branches and 24 members at h = 217] |--[dendrogram w/ 2 branches and 9 members at h = 40.7] | |--[dendrogram w/ 2 branches and 4 members at h = 12.3] | | |--leaf "57" | | `--[dendrogram w/ 2 branches and 3 members at h = 9.47] | | |--leaf "17" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.1] | | |--leaf "16" | | `--leaf "18" | `--[dendrogram w/ 2 branches and 5 members at h = 37.2] | |--[dendrogram w/ 2 branches and 2 members at h = 7.35] | | |--leaf "51" | | `--leaf "52" | `--[dendrogram w/ 2 branches and 3 members at h = 10] | |--leaf "68" | `--[dendrogram w/ 2 branches and 2 members at h = 1.73] | |--leaf "58" | `--leaf "67" `--[dendrogram w/ 2 branches and 15 members at h = 133] |--[dendrogram w/ 2 branches and 4 members at h = 26.5] | |--[dendrogram w/ 2 branches and 2 members at h = 2.45] | | |--leaf "8" | | `--leaf "9" | `--[dendrogram w/ 2 branches and 2 members at h = 5.1] | |--leaf "7" | `--leaf "10" `--[dendrogram w/ 2 branches and 11 members at h = 70.5] |--[dendrogram w/ 2 branches and 4 members at h = 19.2] | |--leaf "50" | `--[dendrogram w/ 2 branches and 3 members at h = 11.4] | |--leaf "47" | `--[dendrogram w/ 2 branches and 2 members at h = 4.58] | |--leaf "48" | `--leaf "49" `--[dendrogram w/ 2 branches and 7 members at h = 39.6] |--[dendrogram w/ 2 branches and 2 members at h = 11.4] | |--leaf "11" | `--leaf "12" `--[dendrogram w/ 2 branches and 5 members at h = 21.5] |--[dendrogram w/ 2 branches and 2 members at h = 2.24] | |--leaf "15" | `--leaf "55" `--[dendrogram w/ 2 branches and 3 members at h = 10.9] |--leaf "56" `--[dendrogram w/ 2 branches and 2 members at h = 3.74] |--leaf "13" `--leaf "14" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/1960j1226246998.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/21s351226246998.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/3pkuf1226246998.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/4t8sl1226246998.tab") + } > > system("convert tmp/1960j1226246998.ps tmp/1960j1226246998.png") > system("convert tmp/21s351226246998.ps tmp/21s351226246998.png") convert: unable to open image `tmp/21s351226246998.ps': No such file or directory. convert: missing an image filename `tmp/21s351226246998.png'. > > > proc.time() user system elapsed 1.136 0.271 1.209