R version 2.6.0 (2007-10-03) 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(467.037,460.070,447.988,442.867,436.087,431.328,484.015,509.673,512.927,502.831,470.984,471.067,476.049,474.605,470.439,461.251,454.724,455.626,516.847,525.192,522.975,518.585,509.239,512.238,519.164,517.009,509.933,509.127,500.857,506.971,569.323,579.714,577.992,565.464,547.344,554.788,562.325,560.854,555.332,543.599,536.662,542.722,593.530,610.763,612.613,611.324,594.167,595.454,590.865,589.379,584.428,573.100,567.456,569.028,620.735,628.884,628.232,612.117,595.404,597.141,593.408,590.072,579.799,574.205,572.775,572.942,619.567,625.809,619.916,587.625,565.742,557.274),dim=c(1,72),dimnames=list(c('WH'),1:72)) > y <- array(NA,dim=c(1,72),dimnames=list(c('WH'),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 = 2348] |--[dendrogram w/ 2 branches and 42 members at h = 556] | |--[dendrogram w/ 2 branches and 21 members at h = 123] | | |--[dendrogram w/ 2 branches and 4 members at h = 10.3] | | | |--leaf "41" | | | `--[dendrogram w/ 2 branches and 3 members at h = 5.29] | | | |--leaf "35" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.877] | | | |--leaf "40" | | | `--leaf "42" | | `--[dendrogram w/ 2 branches and 17 members at h = 69.7] | | |--[dendrogram w/ 2 branches and 7 members at h = 17.9] | | | |--[dendrogram w/ 2 branches and 4 members at h = 1.79] | | | | |--leaf "64" | | | | `--[dendrogram w/ 2 branches and 3 members at h = 0.275] | | | | |--leaf "65" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.158] | | | | |--leaf "52" | | | | `--leaf "66" | | | `--[dendrogram w/ 2 branches and 3 members at h = 2.32] | | | |--leaf "33" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.085] | | | |--leaf "32" | | | `--leaf "63" | | `--[dendrogram w/ 2 branches and 10 members at h = 33.8] | | |--[dendrogram w/ 2 branches and 5 members at h = 6.04] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.278] | | | | |--leaf "34" | | | | `--leaf "71" | | | `--[dendrogram w/ 2 branches and 3 members at h = 2.19] | | | |--leaf "53" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.295] | | | |--leaf "31" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 5 members at h = 11.7] | | |--[dendrogram w/ 2 branches and 2 members at h = 1.47] | | | |--leaf "37" | | | `--leaf "38" | | `--[dendrogram w/ 2 branches and 3 members at h = 2.77] | | |--leaf "72" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.544] | | |--leaf "36" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 21 members at h = 223] | |--[dendrogram w/ 2 branches and 11 members at h = 24.2] | | |--[dendrogram w/ 2 branches and 6 members at h = 5.23] | | | |--[dendrogram w/ 2 branches and 3 members at h = 0.89] | | | | |--leaf "47" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.122] | | | | |--leaf "43" | | | | `--leaf "61" | | | `--[dendrogram w/ 2 branches and 3 members at h = 2.27] | | | |--leaf "60" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.05] | | | |--leaf "48" | | | `--leaf "59" | | `--[dendrogram w/ 2 branches and 5 members at h = 7.08] | | |--[dendrogram w/ 2 branches and 3 members at h = 1.29] | | | |--leaf "49" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.693] | | | |--leaf "50" | | | `--leaf "62" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.2] | | |--leaf "51" | | `--leaf "70" | `--[dendrogram w/ 2 branches and 10 members at h = 46.2] | |--[dendrogram w/ 2 branches and 4 members at h = 2.11] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.496] | | | |--leaf "45" | | | `--leaf "58" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.561] | | |--leaf "44" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 6 members at h = 19.9] | |--[dendrogram w/ 2 branches and 3 members at h = 1.21] | | |--leaf "55" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.349] | | |--leaf "67" | | `--leaf "69" | `--[dendrogram w/ 2 branches and 3 members at h = 3.45] | |--leaf "68" | `--[dendrogram w/ 2 branches and 2 members at h = 0.652] | |--leaf "56" | `--leaf "57" `--[dendrogram w/ 2 branches and 30 members at h = 606] |--[dendrogram w/ 2 branches and 15 members at h = 57.9] | |--[dendrogram w/ 2 branches and 6 members at h = 13.6] | | |--[dendrogram w/ 2 branches and 2 members at h = 2.22] | | | |--leaf "20" | | | `--leaf "21" | | `--[dendrogram w/ 2 branches and 4 members at h = 3.52] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.162] | | | |--leaf "19" | | | `--leaf "26" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.579] | | |--leaf "22" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 9 members at h = 20.7] | |--[dendrogram w/ 2 branches and 2 members at h = 1.97] | | |--leaf "10" | | `--leaf "29" | `--[dendrogram w/ 2 branches and 7 members at h = 8.3] | |--[dendrogram w/ 2 branches and 2 members at h = 0.689] | | |--leaf "9" | | `--leaf "24" | `--[dendrogram w/ 2 branches and 5 members at h = 3.75] | |--leaf "30" | `--[dendrogram w/ 2 branches and 4 members at h = 1.05] | |--[dendrogram w/ 2 branches and 2 members at h = 0.112] | | |--leaf "23" | | `--leaf "28" | `--[dendrogram w/ 2 branches and 2 members at h = 0.26] | |--leaf "8" | `--leaf "27" `--[dendrogram w/ 2 branches and 15 members at h = 121] |--[dendrogram w/ 2 branches and 7 members at h = 18.7] | |--[dendrogram w/ 2 branches and 4 members at h = 5.48] | | |--leaf "1" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.754] | | |--leaf "15" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.083] | | |--leaf "11" | | `--leaf "12" | `--[dendrogram w/ 2 branches and 3 members at h = 11.1] | |--leaf "7" | `--[dendrogram w/ 2 branches and 2 members at h = 1.44] | |--leaf "13" | `--leaf "14" `--[dendrogram w/ 2 branches and 8 members at h = 53.2] |--[dendrogram w/ 2 branches and 4 members at h = 9.93] | |--[dendrogram w/ 2 branches and 2 members at h = 0.902] | | |--leaf "17" | | `--leaf "18" | `--[dendrogram w/ 2 branches and 2 members at h = 1.18] | |--leaf "2" | `--leaf "16" `--[dendrogram w/ 2 branches and 4 members at h = 18.5] |--[dendrogram w/ 2 branches and 2 members at h = 4.76] | |--leaf "5" | `--leaf "6" `--[dendrogram w/ 2 branches and 2 members at h = 5.12] |--leaf "3" `--leaf "4" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1089v1196895072.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/2sddq1196895072.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/328is1196895072.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/4e5vn1196895072.tab") + } > > system("convert tmp/1089v1196895072.ps tmp/1089v1196895072.png") > system("convert tmp/2sddq1196895072.ps tmp/2sddq1196895072.png") convert: unable to open image `tmp/2sddq1196895072.ps': No such file or directory. convert: missing an image filename `tmp/2sddq1196895072.png'. > > > proc.time() user system elapsed 0.872 0.196 0.963