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(569 + ,117.8 + ,77.9 + ,85.7 + ,580 + ,113.5 + ,60 + ,61.9 + ,578 + ,121.2 + ,99.5 + ,104.9 + ,565 + ,130.4 + ,95 + ,107.9 + ,547 + ,115.2 + ,105.6 + ,95.6 + ,555 + ,117.9 + ,102.5 + ,79.8 + ,562 + ,110.7 + ,93.3 + ,94.8 + ,561 + ,107.6 + ,97.3 + ,93.7 + ,555 + ,124.3 + ,127 + ,108.1 + ,544 + ,115.1 + ,111.7 + ,96.9 + ,537 + ,112.5 + ,96.4 + ,88.8 + ,543 + ,127.9 + ,133 + ,106.7 + ,594 + ,117.4 + ,72.2 + ,86.8 + ,611 + ,119.3 + ,95.8 + ,69.8 + ,613 + ,130.4 + ,124.1 + ,110.9 + ,611 + ,126 + ,127.6 + ,105.4 + ,594 + ,125.4 + ,110.7 + ,99.2 + ,595 + ,130.5 + ,104.6 + ,84.4 + ,591 + ,115.9 + ,112.7 + ,87.2 + ,589 + ,108.7 + ,115.3 + ,91.9 + ,584 + ,124 + ,139.4 + ,97.9 + ,573 + ,119.4 + ,119 + ,94.5 + ,567 + ,118.6 + ,97.4 + ,85 + ,569 + ,131.3 + ,154 + ,100.3 + ,621 + ,111.1 + ,81.5 + ,78.7 + ,629 + ,124.8 + ,88.8 + ,65.8 + ,628 + ,132.3 + ,127.7 + ,104.8 + ,612 + ,126.7 + ,105.1 + ,96 + ,595 + ,131.7 + ,114.9 + ,103.3 + ,597 + ,130.9 + ,106.4 + ,82.9 + ,593 + ,122.1 + ,104.5 + ,91.4 + ,590 + ,113.2 + ,121.6 + ,94.5 + ,580 + ,133.6 + ,141.4 + ,109.3 + ,574 + ,119.2 + ,99 + ,92.1 + ,573 + ,129.4 + ,126.7 + ,99.3 + ,573 + ,131.4 + ,134.1 + ,109.6 + ,620 + ,117.1 + ,81.3 + ,87.5 + ,626 + ,130.5 + ,88.6 + ,73.1 + ,620 + ,132.3 + ,132.7 + ,110.7 + ,588 + ,140.8 + ,132.9 + ,111.6 + ,566 + ,137.5 + ,134.4 + ,110.7 + ,557 + ,128.6 + ,103.7 + ,84 + ,561 + ,126.7 + ,119.7 + ,101.6 + ,549 + ,120.8 + ,115 + ,102.1 + ,532 + ,139.3 + ,132.9 + ,113.9 + ,526 + ,128.6 + ,108.5 + ,99 + ,511 + ,131.3 + ,113.9 + ,100.4 + ,499 + ,136.3 + ,142 + ,109.5 + ,555 + ,128.8 + ,97.7 + ,93.1 + ,565 + ,133.2 + ,92.2 + ,77 + ,542 + ,136.3 + ,128.8 + ,108 + ,527 + ,151.1 + ,134.9 + ,119.9 + ,510 + ,145 + ,128.2 + ,105.9 + ,514 + ,134.4 + ,114.8 + ,78.2 + ,517 + ,135.7 + ,117.9 + ,100.3 + ,508 + ,128.7 + ,119.1 + ,102.2 + ,493 + ,129.2 + ,120.7 + ,97 + ,490 + ,138.6 + ,129.1 + ,101.3 + ,469 + ,132.7 + ,117.6 + ,89.2 + ,478 + ,132.5 + ,129.2 + ,93.3 + ,528 + ,135.2 + ,99.1 + ,86.4) + ,dim=c(4 + ,61) + ,dimnames=list(c('werkloosheid' + ,'voeding_dranken' + ,'automobiel' + ,'textiel') + ,1:61)) > y <- array(NA,dim=c(4,61),dimnames=list(c('werkloosheid','voeding_dranken','automobiel','textiel'),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 = 976] |--[dendrogram w/ 2 branches and 16 members at h = 141] | |--[dendrogram w/ 2 branches and 6 members at h = 50.4] | | |--[dendrogram w/ 2 branches and 2 members at h = 20] | | | |--leaf "48" | | | `--leaf "53" | | `--[dendrogram w/ 2 branches and 4 members at h = 28.9] | | |--[dendrogram w/ 2 branches and 2 members at h = 13.7] | | | |--leaf "57" | | | `--leaf "58" | | `--[dendrogram w/ 2 branches and 2 members at h = 15.2] | | |--leaf "59" | | `--leaf "60" | `--[dendrogram w/ 2 branches and 10 members at h = 106] | |--[dendrogram w/ 2 branches and 4 members at h = 31.2] | | |--[dendrogram w/ 2 branches and 2 members at h = 9.53] | | | |--leaf "12" | | | `--leaf "51" | | `--[dendrogram w/ 2 branches and 2 members at h = 14.3] | | |--leaf "45" | | `--leaf "52" | `--[dendrogram w/ 2 branches and 6 members at h = 38.9] | |--[dendrogram w/ 2 branches and 3 members at h = 11.1] | | |--leaf "55" | | `--[dendrogram w/ 2 branches and 2 members at h = 6.79] | | |--leaf "47" | | `--leaf "56" | `--[dendrogram w/ 2 branches and 3 members at h = 26.3] | |--leaf "54" | `--[dendrogram w/ 2 branches and 2 members at h = 17.2] | |--leaf "46" | `--leaf "61" `--[dendrogram w/ 2 branches and 45 members at h = 358] |--[dendrogram w/ 2 branches and 23 members at h = 222] | |--[dendrogram w/ 2 branches and 10 members at h = 60] | | |--[dendrogram w/ 2 branches and 4 members at h = 25] | | | |--[dendrogram w/ 2 branches and 2 members at h = 11.7] | | | | |--leaf "9" | | | | `--leaf "43" | | | `--[dendrogram w/ 2 branches and 2 members at h = 13.5] | | | |--leaf "22" | | | `--leaf "35" | | `--[dendrogram w/ 2 branches and 6 members at h = 28.1] | | |--leaf "24" | | `--[dendrogram w/ 2 branches and 5 members at h = 25] | | |--[dendrogram w/ 2 branches and 2 members at h = 9.35] | | | |--leaf "36" | | | `--leaf "41" | | `--[dendrogram w/ 2 branches and 3 members at h = 21.1] | | |--leaf "21" | | `--[dendrogram w/ 2 branches and 2 members at h = 13.9] | | |--leaf "33" | | `--leaf "40" | `--[dendrogram w/ 2 branches and 13 members at h = 127] | |--[dendrogram w/ 2 branches and 4 members at h = 20.0] | | |--[dendrogram w/ 2 branches and 2 members at h = 8.12] | | | |--leaf "15" | | | `--leaf "16" | | `--[dendrogram w/ 2 branches and 2 members at h = 11.1] | | |--leaf "27" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 9 members at h = 42.7] | |--[dendrogram w/ 2 branches and 4 members at h = 19.5] | | |--[dendrogram w/ 2 branches and 2 members at h = 8.23] | | | |--leaf "20" | | | `--leaf "32" | | `--[dendrogram w/ 2 branches and 2 members at h = 11.3] | | |--leaf "19" | | `--leaf "31" | `--[dendrogram w/ 2 branches and 5 members at h = 32.9] | |--[dendrogram w/ 2 branches and 2 members at h = 3.11] | | |--leaf "18" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 3 members at h = 24.2] | |--leaf "28" | `--[dendrogram w/ 2 branches and 2 members at h = 8.67] | |--leaf "17" | `--leaf "29" `--[dendrogram w/ 2 branches and 22 members at h = 339] |--[dendrogram w/ 2 branches and 14 members at h = 75.5] | |--[dendrogram w/ 2 branches and 4 members at h = 25.8] | | |--leaf "11" | | `--[dendrogram w/ 2 branches and 3 members at h = 12.8] | | |--leaf "44" | | `--[dendrogram w/ 2 branches and 2 members at h = 6.92] | | |--leaf "5" | | `--leaf "10" | `--[dendrogram w/ 2 branches and 10 members at h = 49.3] | |--[dendrogram w/ 2 branches and 4 members at h = 22.1] | | |--leaf "50" | | `--[dendrogram w/ 2 branches and 3 members at h = 16.0] | | |--leaf "6" | | `--[dendrogram w/ 2 branches and 2 members at h = 11.1] | | |--leaf "42" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 6 members at h = 36.6] | |--[dendrogram w/ 2 branches and 2 members at h = 16.8] | | |--leaf "3" | | `--leaf "4" | `--[dendrogram w/ 2 branches and 4 members at h = 23.8] | |--[dendrogram w/ 2 branches and 2 members at h = 5.27] | | |--leaf "7" | | `--leaf "8" | `--[dendrogram w/ 2 branches and 2 members at h = 10.1] | |--leaf "23" | `--leaf "34" `--[dendrogram w/ 2 branches and 8 members at h = 113] |--[dendrogram w/ 2 branches and 3 members at h = 33.7] | |--leaf "2" | `--[dendrogram w/ 2 branches and 2 members at h = 25.7] | |--leaf "1" | `--leaf "13" `--[dendrogram w/ 2 branches and 5 members at h = 35] |--[dendrogram w/ 2 branches and 2 members at h = 10.7] | |--leaf "25" | `--leaf "37" `--[dendrogram w/ 2 branches and 3 members at h = 24.0] |--leaf "14" `--[dendrogram w/ 2 branches and 2 members at h = 9.74] |--leaf "26" `--leaf "38" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1l8811226221001.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/2gd3m1226221001.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/3ooxw1226221001.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/4to501226221001.tab") + } > > system("convert tmp/1l8811226221001.ps tmp/1l8811226221001.png") > system("convert tmp/2gd3m1226221001.ps tmp/2gd3m1226221001.png") convert: unable to open image `tmp/2gd3m1226221001.ps': No such file or directory. convert: missing an image filename `tmp/2gd3m1226221001.png'. > > > proc.time() user system elapsed 0.825 0.211 4.707