R version 2.6.1 (2007-11-26) Copyright (C) 2007 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(88900,124.9,87280,132,85519,151.4,83647,108.9,81616,121.3,80100,123.4,94027,90.3,102327,79.3,104296,117.2,101593,116.9,94816,120.8,93535,96.1,93618,100.8,92330,105.3,90751,116.1,88576,112.8,86102,114.5,85494,117.2,103432,77.1,108870,80.1,109713,120.3,106960,133.4,103195,109.4,102348,93.2,102158,91.2,100431,99.2,97649,108.2,95611,101.5,93035,106.9,93579,104.4,111777,77.9,116065,60,116609,99.5,112934,95,107660,105.6,107965,102.5,107772,93.3,106201,97.3,102288,127,99217,111.7,96511,96.4,96456,133,113021,72.2,117836,95.8,118492,124.1,113922,127.6,109317,110.7,107496,104.6,105524,112.7,103824,115.3,101833,139.4,99436,119,96915,97.4,96072,154,111941,81.5,116008,88.8,117557,127.7,113445,105.1,108762,114.9,106661,106.4,102824,104.5,101912,121.6,99005,141.4,97894,99,96256,126.7,95606,134.1,108948,81.3,111223,88.6,113142,132.7,106078,132.9,100992,134.4,97413,103.7),dim=c(2,72),dimnames=list(c('werkl50','prodtransp'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('werkl50','prodtransp'),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: Wessa, P., (2007), Hierarchical Clustering (v1.0.1) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_hierarchicalclustering.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 = 329604] |--[dendrogram w/ 2 branches and 27 members at h = 86096] | |--[dendrogram w/ 2 branches and 10 members at h = 15594] | | |--[dendrogram w/ 2 branches and 4 members at h = 3208] | | | |--leaf "15" | | | `--[dendrogram w/ 2 branches and 3 members at h = 1836] | | | |--leaf "2" | | | `--[dendrogram w/ 2 branches and 2 members at h = 324] | | | |--leaf "1" | | | `--leaf "16" | | `--[dendrogram w/ 2 branches and 6 members at h = 9308] | | |--[dendrogram w/ 2 branches and 2 members at h = 1516] | | | |--leaf "5" | | | `--leaf "6" | | `--[dendrogram w/ 2 branches and 4 members at h = 2881] | | |--leaf "4" | | `--[dendrogram w/ 2 branches and 3 members at h = 781] | | |--leaf "17" | | `--[dendrogram w/ 2 branches and 2 members at h = 42.4] | | |--leaf "3" | | `--leaf "18" | `--[dendrogram w/ 2 branches and 17 members at h = 18028] | |--[dendrogram w/ 2 branches and 6 members at h = 1963] | | |--[dendrogram w/ 2 branches and 4 members at h = 647] | | | |--leaf "7" | | | `--[dendrogram w/ 2 branches and 3 members at h = 72.2] | | | |--leaf "12" | | | `--[dendrogram w/ 2 branches and 2 members at h = 39.2] | | | |--leaf "13" | | | `--leaf "30" | | `--[dendrogram w/ 2 branches and 2 members at h = 705] | | |--leaf "14" | | `--leaf "29" | `--[dendrogram w/ 2 branches and 11 members at h = 5111] | |--[dendrogram w/ 2 branches and 3 members at h = 405] | | |--leaf "64" | | `--[dendrogram w/ 2 branches and 2 members at h = 236] | | |--leaf "27" | | `--leaf "72" | `--[dendrogram w/ 2 branches and 8 members at h = 2858] | |--[dendrogram w/ 2 branches and 5 members at h = 794] | | |--leaf "53" | | `--[dendrogram w/ 2 branches and 4 members at h = 516] | | |--[dendrogram w/ 2 branches and 2 members at h = 66] | | | |--leaf "41" | | | `--leaf "42" | | `--[dendrogram w/ 2 branches and 2 members at h = 186] | | |--leaf "54" | | `--leaf "65" | `--[dendrogram w/ 2 branches and 3 members at h = 1046] | |--leaf "11" | `--[dendrogram w/ 2 branches and 2 members at h = 33] | |--leaf "28" | `--leaf "66" `--[dendrogram w/ 2 branches and 45 members at h = 132892] |--[dendrogram w/ 2 branches and 14 members at h = 23424] | |--[dendrogram w/ 2 branches and 6 members at h = 4177] | | |--[dendrogram w/ 2 branches and 3 members at h = 743] | | | |--leaf "33" | | | `--[dendrogram w/ 2 branches and 2 members at h = 63.9] | | | |--leaf "32" | | | `--leaf "56" | | `--[dendrogram w/ 2 branches and 3 members at h = 967] | | |--leaf "45" | | `--[dendrogram w/ 2 branches and 2 members at h = 281] | | |--leaf "44" | | `--leaf "57" | `--[dendrogram w/ 2 branches and 8 members at h = 4851] | |--[dendrogram w/ 2 branches and 3 members at h = 793] | | |--leaf "68" | | `--[dendrogram w/ 2 branches and 2 members at h = 164] | | |--leaf "31" | | `--leaf "55" | `--[dendrogram w/ 2 branches and 5 members at h = 1162] | |--[dendrogram w/ 2 branches and 3 members at h = 201] | | |--leaf "69" | | `--[dendrogram w/ 2 branches and 2 members at h = 90] | | |--leaf "34" | | `--leaf "43" | `--[dendrogram w/ 2 branches and 2 members at h = 478] | |--leaf "46" | `--leaf "58" `--[dendrogram w/ 2 branches and 31 members at h = 66129] |--[dendrogram w/ 2 branches and 14 members at h = 9965] | |--[dendrogram w/ 2 branches and 5 members at h = 1235] | | |--[dendrogram w/ 2 branches and 3 members at h = 176] | | | |--leaf "59" | | | `--[dendrogram w/ 2 branches and 2 members at h = 78] | | | |--leaf "20" | | | `--leaf "67" | | `--[dendrogram w/ 2 branches and 2 members at h = 396] | | |--leaf "21" | | `--leaf "47" | `--[dendrogram w/ 2 branches and 9 members at h = 4742] | |--[dendrogram w/ 2 branches and 4 members at h = 391] | | |--leaf "36" | | `--[dendrogram w/ 2 branches and 3 members at h = 256] | | |--leaf "48" | | `--[dendrogram w/ 2 branches and 2 members at h = 113] | | |--leaf "35" | | `--leaf "37" | `--[dendrogram w/ 2 branches and 5 members at h = 1561] | |--[dendrogram w/ 2 branches and 2 members at h = 300] | | |--leaf "22" | | `--leaf "60" | `--[dendrogram w/ 2 branches and 3 members at h = 778] | |--leaf "49" | `--[dendrogram w/ 2 branches and 2 members at h = 128] | |--leaf "38" | `--leaf "70" `--[dendrogram w/ 2 branches and 17 members at h = 14013] |--[dendrogram w/ 2 branches and 5 members at h = 3014] | |--[dendrogram w/ 2 branches and 3 members at h = 362] | | |--leaf "52" | | `--[dendrogram w/ 2 branches and 2 members at h = 214] | | |--leaf "40" | | `--leaf "63" | `--[dendrogram w/ 2 branches and 2 members at h = 562] | |--leaf "26" | `--leaf "71" `--[dendrogram w/ 2 branches and 12 members at h = 5912] |--[dendrogram w/ 2 branches and 7 members at h = 1339] | |--[dendrogram w/ 2 branches and 4 members at h = 221] | | |--leaf "25" | | `--[dendrogram w/ 2 branches and 3 members at h = 78.6] | | |--leaf "39" | | `--[dendrogram w/ 2 branches and 2 members at h = 25.2] | | |--leaf "8" | | `--leaf "24" | `--[dendrogram w/ 2 branches and 3 members at h = 346] | |--leaf "10" | `--[dendrogram w/ 2 branches and 2 members at h = 81] | |--leaf "51" | `--leaf "62" `--[dendrogram w/ 2 branches and 5 members at h = 1576] |--[dendrogram w/ 2 branches and 2 members at h = 472] | |--leaf "9" | `--leaf "50" `--[dendrogram w/ 2 branches and 3 members at h = 573] |--leaf "61" `--[dendrogram w/ 2 branches and 2 members at h = 239] |--leaf "19" `--leaf "23" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1ditc1197888181.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/2ribl1197888181.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) + } > 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/3n6bf1197888181.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/4mlhh1197888181.tab") + } > > system("convert tmp/1ditc1197888181.ps tmp/1ditc1197888181.png") > system("convert tmp/2ribl1197888181.ps tmp/2ribl1197888181.png") convert: unable to open image `tmp/2ribl1197888181.ps': No such file or directory. convert: missing an image filename `tmp/2ribl1197888181.png'. > > > proc.time() user system elapsed 1.597 0.301 1.662