R version 2.8.0 (2008-10-20) 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(0.771 + ,493.000 + ,58.972 + ,54.281 + ,0.751 + ,481.000 + ,59.249 + ,63.654 + ,0.766 + ,462.000 + ,63.955 + ,68.918 + ,0.754 + ,457.000 + ,53.785 + ,58.686 + ,0.773 + ,442.000 + ,52.760 + ,67.074 + ,0.781 + ,439.000 + ,44.795 + ,60.183 + ,0.793 + ,488.000 + ,37.348 + ,54.326 + ,0.791 + ,521.000 + ,32.370 + ,54.085 + ,0.878 + ,501.000 + ,32.717 + ,53.564 + ,0.873 + ,485.000 + ,40.974 + ,60.873 + ,0.897 + ,464.000 + ,33.591 + ,53.398 + ,0.885 + ,460.000 + ,21.124 + ,45.164 + ,0.796 + ,467.000 + ,58.608 + ,59.672 + ,0.776 + ,460.000 + ,46.865 + ,56.298 + ,0.788 + ,448.000 + ,51.378 + ,62.361 + ,0.786 + ,443.000 + ,46.235 + ,56.930 + ,0.801 + ,436.000 + ,47.206 + ,62.954 + ,0.811 + ,431.000 + ,45.382 + ,62.431 + ,0.801 + ,484.000 + ,41.227 + ,52.528 + ,0.781 + ,510.000 + ,33.795 + ,54.060 + ,0.778 + ,513.000 + ,31.295 + ,53.093 + ,0.759 + ,503.000 + ,42.625 + ,52.695 + ,0.764 + ,471.000 + ,33.625 + ,52.333 + ,0.754 + ,471.000 + ,21.538 + ,41.747 + ,0.749 + ,476.000 + ,56.421 + ,58.576 + ,0.729 + ,475.000 + ,53.152 + ,57.851 + ,0.740 + ,470.000 + ,53.536 + ,63.721 + ,0.781 + ,461.000 + ,52.408 + ,63.384 + ,0.768 + ,455.000 + ,41.454 + ,61.141 + ,0.754 + ,456.000 + ,38.271 + ,59.231 + ,0.754 + ,517.000 + ,35.306 + ,63.472 + ,0.754 + ,525.000 + ,26.414 + ,49.214 + ,0.779 + ,523.000 + ,31.917 + ,55.816 + ,0.799 + ,519.000 + ,38.030 + ,61.713 + ,0.780 + ,509.000 + ,27.534 + ,48.664 + ,0.769 + ,512.000 + ,18.387 + ,45.351 + ,0.801 + ,519.000 + ,50.556 + ,57.888 + ,0.792 + ,517.000 + ,43.901 + ,54.091 + ,0.852 + ,510.000 + ,48.572 + ,59.098 + ,0.807 + ,509.000 + ,43.899 + ,58.962 + ,0.797 + ,501.000 + ,37.532 + ,55.433 + ,0.783 + ,507.000 + ,40.357 + ,60.403 + ,0.779 + ,569.000 + ,35.489 + ,60.721 + ,0.785 + ,580.000 + ,29.027 + ,48.440 + ,0.817 + ,578.000 + ,34.485 + ,57.981 + ,0.810 + ,565.000 + ,42.598 + ,60.258 + ,0.798 + ,547.000 + ,30.306 + ,47.312 + ,0.795 + ,555.000 + ,26.451 + ,46.980 + ,0.785 + ,562.000 + ,47.460 + ,54.846 + ,0.785 + ,561.000 + ,50.104 + ,56.824 + ,0.785 + ,555.000 + ,61.465 + ,67.744 + ,0.805 + ,544.000 + ,53.726 + ,62.849 + ,0.824 + ,537.000 + ,39.477 + ,54.691 + ,0.819 + ,543.000 + ,43.895 + ,65.461 + ,0.827 + ,594.000 + ,31.481 + ,53.724 + ,0.826 + ,611.000 + ,29.896 + ,54.560 + ,0.829 + ,613.000 + ,33.842 + ,57.722 + ,0.830 + ,611.000 + ,39.120 + ,55.458 + ,0.825 + ,594.000 + ,33.702 + ,48.490 + ,0.817 + ,595.000 + ,25.094 + ,46.362) + ,dim=c(4 + ,60) + ,dimnames=list(c('1' + ,'2' + ,'3' + ,'4') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('1','2','3','4'),1:60)) > 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 60 members at h = 1430] |--[dendrogram w/ 2 branches and 18 members at h = 256] | |--[dendrogram w/ 2 branches and 10 members at h = 56.5] | | |--[dendrogram w/ 2 branches and 4 members at h = 26.6] | | | |--leaf "51" | | | `--[dendrogram w/ 2 branches and 3 members at h = 17.2] | | | |--leaf "53" | | | `--[dendrogram w/ 2 branches and 2 members at h = 10.2] | | | |--leaf "52" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 6 members at h = 49.4] | | |--[dendrogram w/ 2 branches and 2 members at h = 8.89] | | | |--leaf "47" | | | `--leaf "48" | | `--[dendrogram w/ 2 branches and 4 members at h = 18.8] | | |--[dendrogram w/ 2 branches and 2 members at h = 3.45] | | | |--leaf "49" | | | `--leaf "50" | | `--[dendrogram w/ 2 branches and 2 members at h = 8.17] | | |--leaf "43" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 8 members at h = 65.5] | |--[dendrogram w/ 2 branches and 3 members at h = 8.42] | | |--leaf "58" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.44] | | |--leaf "56" | | `--leaf "57" | `--[dendrogram w/ 2 branches and 5 members at h = 28.2] | |--[dendrogram w/ 2 branches and 3 members at h = 10.6] | | |--leaf "60" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.69] | | |--leaf "55" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 2 members at h = 11.2] | |--leaf "44" | `--leaf "45" `--[dendrogram w/ 2 branches and 42 members at h = 666] |--[dendrogram w/ 2 branches and 17 members at h = 52.6] | |--[dendrogram w/ 2 branches and 7 members at h = 31.1] | | |--[dendrogram w/ 2 branches and 3 members at h = 9.12] | | | |--leaf "22" | | | `--[dendrogram w/ 2 branches and 2 members at h = 5.17] | | | |--leaf "9" | | | `--leaf "41" | | `--[dendrogram w/ 2 branches and 4 members at h = 18.3] | | |--leaf "36" | | `--[dendrogram w/ 2 branches and 3 members at h = 8.91] | | |--leaf "35" | | `--[dendrogram w/ 2 branches and 2 members at h = 4.02] | | |--leaf "20" | | `--leaf "21" | `--[dendrogram w/ 2 branches and 10 members at h = 47.5] | |--[dendrogram w/ 2 branches and 5 members at h = 18] | | |--[dendrogram w/ 2 branches and 3 members at h = 7.64] | | | |--leaf "39" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.32] | | | |--leaf "40" | | | `--leaf "42" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.92] | | |--leaf "37" | | `--leaf "38" | `--[dendrogram w/ 2 branches and 5 members at h = 23] | |--[dendrogram w/ 2 branches and 2 members at h = 3.81] | | |--leaf "31" | | `--leaf "34" | `--[dendrogram w/ 2 branches and 3 members at h = 10.8] | |--leaf "32" | `--[dendrogram w/ 2 branches and 2 members at h = 2.68] | |--leaf "8" | `--leaf "33" `--[dendrogram w/ 2 branches and 25 members at h = 172] |--[dendrogram w/ 2 branches and 6 members at h = 19.6] | |--[dendrogram w/ 2 branches and 2 members at h = 7.75] | | |--leaf "5" | | `--leaf "15" | `--[dendrogram w/ 2 branches and 4 members at h = 10.9] | |--leaf "16" | `--[dendrogram w/ 2 branches and 3 members at h = 7.54] | |--leaf "18" | `--[dendrogram w/ 2 branches and 2 members at h = 4.74] | |--leaf "6" | `--leaf "17" `--[dendrogram w/ 2 branches and 19 members at h = 108] |--[dendrogram w/ 2 branches and 11 members at h = 55] | |--[dendrogram w/ 2 branches and 5 members at h = 14.9] | | |--[dendrogram w/ 2 branches and 2 members at h = 7.15] | | | |--leaf "13" | | | `--leaf "27" | | `--[dendrogram w/ 2 branches and 3 members at h = 10.8] | | |--leaf "2" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.49] | | |--leaf "25" | | `--leaf "26" | `--[dendrogram w/ 2 branches and 6 members at h = 28.0] | |--[dendrogram w/ 2 branches and 2 members at h = 3.84] | | |--leaf "29" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 4 members at h = 20.8] | |--leaf "3" | `--[dendrogram w/ 2 branches and 3 members at h = 9.2] | |--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 6.32] | |--leaf "4" | `--leaf "28" `--[dendrogram w/ 2 branches and 8 members at h = 75.2] |--[dendrogram w/ 2 branches and 4 members at h = 24.6] | |--[dendrogram w/ 2 branches and 2 members at h = 7.08] | | |--leaf "11" | | `--leaf "23" | `--[dendrogram w/ 2 branches and 2 members at h = 11.5] | |--leaf "12" | `--leaf "24" `--[dendrogram w/ 2 branches and 4 members at h = 27.7] |--leaf "1" `--[dendrogram w/ 2 branches and 3 members at h = 9.03] |--leaf "10" `--[dendrogram w/ 2 branches and 2 members at h = 5.85] |--leaf "7" `--leaf "19" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/1jr4p1226338588.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/2ber81226338588.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/309b11226338588.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/49nk41226338588.tab") + } > > system("convert tmp/1jr4p1226338588.ps tmp/1jr4p1226338588.png") > system("convert tmp/2ber81226338588.ps tmp/2ber81226338588.png") convert: unable to open image `tmp/2ber81226338588.ps': No such file or directory. convert: missing an image filename `tmp/2ber81226338588.png'. > > > proc.time() user system elapsed 0.825 0.262 0.996