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(95.90 + ,2.90 + ,96.92 + ,95.86 + ,96.06 + ,2.63 + ,96.06 + ,96.02 + ,96.31 + ,2.67 + ,96.59 + ,96.34 + ,96.34 + ,1.81 + ,96.67 + ,96.84 + ,96.49 + ,1.33 + ,97.27 + ,96.73 + ,96.22 + ,0.88 + ,96.38 + ,96.34 + ,96.53 + ,1.28 + ,96.47 + ,96.60 + ,96.50 + ,1.26 + ,96.05 + ,96.64 + ,96.77 + ,1.26 + ,96.76 + ,97.20 + ,96.66 + ,1.29 + ,96.51 + ,97.50 + ,96.58 + ,1.10 + ,96.55 + ,96.99 + ,96.63 + ,1.37 + ,95.97 + ,97.08 + ,97.06 + ,1.21 + ,97.00 + ,97.55 + ,97.73 + ,1.74 + ,97.46 + ,98.42 + ,98.01 + ,1.76 + ,97.90 + ,98.78 + ,97.76 + ,1.48 + ,98.42 + ,97.49 + ,97.49 + ,1.04 + ,98.54 + ,96.99 + ,97.77 + ,1.62 + ,99.00 + ,97.16 + ,97.96 + ,1.49 + ,98.94 + ,97.29 + ,98.23 + ,1.79 + ,99.02 + ,97.80 + ,98.51 + ,1.80 + ,100.07 + ,98.12 + ,98.19 + ,1.58 + ,98.72 + ,98.03 + ,98.37 + ,1.86 + ,98.73 + ,98.11 + ,98.31 + ,1.74 + ,98.04 + ,98.07 + ,98.60 + ,1.59 + ,99.08 + ,98.21 + ,98.97 + ,1.26 + ,99.22 + ,98.48 + ,99.11 + ,1.13 + ,99.57 + ,98.83 + ,99.64 + ,1.92 + ,100.44 + ,99.20 + ,100.03 + ,2.61 + ,100.84 + ,99.88 + ,99.98 + ,2.26 + ,100.75 + ,99.71 + ,100.32 + ,2.41 + ,100.49 + ,100.03 + ,100.44 + ,2.26 + ,99.98 + ,100.60 + ,100.51 + ,2.03 + ,99.96 + ,100.85 + ,101.00 + ,2.86 + ,99.76 + ,101.96 + ,100.88 + ,2.55 + ,100.11 + ,101.40 + ,100.55 + ,2.27 + ,99.79 + ,100.81 + ,100.83 + ,2.26 + ,100.29 + ,100.66 + ,101.51 + ,2.57 + ,101.12 + ,101.55 + ,102.16 + ,3.07 + ,102.65 + ,102.23 + ,102.39 + ,2.76 + ,102.71 + ,102.90 + ,102.54 + ,2.51 + ,103.39 + ,102.68 + ,102.85 + ,2.87 + ,102.80 + ,103.41 + ,103.47 + ,3.14 + ,102.07 + ,104.62 + ,103.57 + ,3.11 + ,102.15 + ,104.93 + ,103.69 + ,3.16 + ,101.21 + ,105.88 + ,103.50 + ,2.47 + ,101.27 + ,105.18 + ,103.47 + ,2.57 + ,101.86 + ,104.54 + ,103.45 + ,2.89 + ,101.65 + ,104.58 + ,103.48 + ,2.63 + ,101.94 + ,104.34 + ,103.93 + ,2.38 + ,102.62 + ,104.66 + ,103.89 + ,1.69 + ,102.71 + ,104.73 + ,104.40 + ,1.96 + ,103.39 + ,105.44 + ,104.79 + ,2.19 + ,104.51 + ,105.72 + ,104.77 + ,1.87 + ,104.09 + ,105.68 + ,105.13 + ,1.60 + ,104.29 + ,105.90 + ,105.26 + ,1.63 + ,104.57 + ,105.97 + ,104.96 + ,1.22 + ,105.39 + ,105.21 + ,104.75 + ,1.21 + ,105.15 + ,104.75 + ,105.01 + ,1.49 + ,106.13 + ,104.89 + ,105.15 + ,1.64 + ,105.46 + ,105.26 + ,105.20 + ,1.66 + ,106.47 + ,104.84 + ,105.77 + ,1.77 + ,106.62 + ,105.47 + ,105.78 + ,1.82 + ,106.52 + ,105.40 + ,106.26 + ,1.78 + ,108.04 + ,105.73 + ,106.13 + ,1.28 + ,107.15 + ,105.72 + ,106.12 + ,1.29 + ,107.32 + ,105.63 + ,106.57 + ,1.37 + ,107.76 + ,105.97 + ,106.44 + ,1.12 + ,107.26 + ,105.92 + ,106.54 + ,1.51 + ,107.89 + ,106.32) + ,dim=c(4 + ,69) + ,dimnames=list(c('1' + ,'2' + ,'3' + ,'4') + ,1:69)) > y <- array(NA,dim=c(4,69),dimnames=list(c('1','2','3','4'),1:69)) > 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 69 members at h = 236] |--[dendrogram w/ 2 branches and 27 members at h = 27.7] | |--[dendrogram w/ 2 branches and 14 members at h = 4.34] | | |--[dendrogram w/ 2 branches and 7 members at h = 2.40] | | | |--[dendrogram w/ 2 branches and 4 members at h = 0.632] | | | | |--leaf "25" | | | | `--[dendrogram w/ 2 branches and 3 members at h = 0.477] | | | | |--leaf "20" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.342] | | | | |--leaf "22" | | | | `--leaf "23" | | | `--[dendrogram w/ 2 branches and 3 members at h = 1.43] | | | |--leaf "21" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.531] | | | |--leaf "26" | | | `--leaf "27" | | `--[dendrogram w/ 2 branches and 7 members at h = 3.93] | | |--[dendrogram w/ 2 branches and 3 members at h = 0.906] | | | |--leaf "24" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.634] | | | |--leaf "14" | | | `--leaf "15" | | `--[dendrogram w/ 2 branches and 4 members at h = 0.952] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.271] | | | |--leaf "18" | | | `--leaf "19" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.729] | | |--leaf "16" | | `--leaf "17" | `--[dendrogram w/ 2 branches and 13 members at h = 5.72] | |--[dendrogram w/ 2 branches and 3 members at h = 0.896] | | |--leaf "1" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.669] | | |--leaf "2" | | `--leaf "3" | `--[dendrogram w/ 2 branches and 10 members at h = 2.00] | |--[dendrogram w/ 2 branches and 4 members at h = 0.875] | | |--leaf "6" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.649] | | |--leaf "12" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.423] | | |--leaf "7" | | `--leaf "8" | `--[dendrogram w/ 2 branches and 6 members at h = 1.37] | |--[dendrogram w/ 2 branches and 4 members at h = 0.79] | | |--leaf "13" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.51] | | |--leaf "10" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.387] | | |--leaf "9" | | `--leaf "11" | `--[dendrogram w/ 2 branches and 2 members at h = 0.79] | |--leaf "4" | `--leaf "5" `--[dendrogram w/ 2 branches and 42 members at h = 86] |--[dendrogram w/ 2 branches and 17 members at h = 13.3] | |--[dendrogram w/ 2 branches and 6 members at h = 1.72] | | |--[dendrogram w/ 2 branches and 3 members at h = 0.526] | | | |--leaf "68" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.193] | | | |--leaf "65" | | | `--leaf "66" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.77] | | |--leaf "64" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.4] | | |--leaf "67" | | `--leaf "69" | `--[dendrogram w/ 2 branches and 11 members at h = 6.27] | |--[dendrogram w/ 2 branches and 4 members at h = 0.993] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.318] | | | |--leaf "55" | | | `--leaf "56" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.53] | | |--leaf "53" | | `--leaf "54" | `--[dendrogram w/ 2 branches and 7 members at h = 2.96] | |--[dendrogram w/ 2 branches and 3 members at h = 0.775] | | |--leaf "58" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.469] | | |--leaf "57" | | `--leaf "60" | `--[dendrogram w/ 2 branches and 4 members at h = 1.65] | |--[dendrogram w/ 2 branches and 2 members at h = 0.132] | | |--leaf "62" | | `--leaf "63" | `--[dendrogram w/ 2 branches and 2 members at h = 0.428] | |--leaf "59" | `--leaf "61" `--[dendrogram w/ 2 branches and 25 members at h = 45.7] |--[dendrogram w/ 2 branches and 11 members at h = 5.57] | |--[dendrogram w/ 2 branches and 4 members at h = 1.29] | | |--leaf "28" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.582] | | |--leaf "31" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.402] | | |--leaf "29" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 7 members at h = 2.78] | |--[dendrogram w/ 2 branches and 4 members at h = 0.663] | | |--leaf "37" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.334] | | |--leaf "32" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.299] | | |--leaf "33" | | `--leaf "36" | `--[dendrogram w/ 2 branches and 3 members at h = 1.58] | |--leaf "38" | `--[dendrogram w/ 2 branches and 2 members at h = 0.74] | |--leaf "34" | `--leaf "35" `--[dendrogram w/ 2 branches and 14 members at h = 10.0] |--[dendrogram w/ 2 branches and 4 members at h = 1.21] | |--leaf "39" | `--[dendrogram w/ 2 branches and 3 members at h = 0.982] | |--leaf "41" | `--[dendrogram w/ 2 branches and 2 members at h = 0.701] | |--leaf "40" | `--leaf "42" `--[dendrogram w/ 2 branches and 10 members at h = 4.11] |--[dendrogram w/ 2 branches and 3 members at h = 1.37] | |--leaf "52" | `--[dendrogram w/ 2 branches and 2 members at h = 0.7] | |--leaf "50" | `--leaf "51" `--[dendrogram w/ 2 branches and 7 members at h = 2.34] |--[dendrogram w/ 2 branches and 2 members at h = 1.00] | |--leaf "45" | `--leaf "46" `--[dendrogram w/ 2 branches and 5 members at h = 1.07] |--[dendrogram w/ 2 branches and 2 members at h = 0.337] | |--leaf "43" | `--leaf "44" `--[dendrogram w/ 2 branches and 3 members at h = 0.488] |--leaf "48" `--[dendrogram w/ 2 branches and 2 members at h = 0.224] |--leaf "47" `--leaf "49" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/14dgd1194257576.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/2i8dv1194257577.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/3s5go1194257577.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/4jihx1194257578.tab") + } > > system("convert tmp/14dgd1194257576.ps tmp/14dgd1194257576.png") > system("convert tmp/2i8dv1194257577.ps tmp/2i8dv1194257577.png") convert: unable to open image `tmp/2i8dv1194257577.ps': No such file or directory. convert: missing an image filename `tmp/2i8dv1194257577.png'. > > > proc.time() user system elapsed 0.902 0.203 1.020