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(101.5 + ,110.4 + ,92.1 + ,101.3 + ,112.9 + ,88.5 + ,99.3 + ,109.4 + ,84.6 + ,100.6 + ,111.9 + ,87 + ,101.2 + ,108.9 + ,83.6 + ,99.8 + ,113.8 + ,84.8 + ,100.6 + ,114.5 + ,84.1 + ,101.1 + ,113.2 + ,84.1 + ,101.2 + ,111 + ,80.5 + ,101.5 + ,114.6 + ,82.6 + ,102.2 + ,113.1 + ,85.6 + ,102.5 + ,113.2 + ,83.3 + ,101.4 + ,115.1 + ,86.1 + ,103.8 + ,117.6 + ,84.7 + ,105.2 + ,117.8 + ,85.7 + ,105.3 + ,115.7 + ,84.9 + ,104.4 + ,115.7 + ,84.2 + ,104.9 + ,118.3 + ,85.2 + ,106.9 + ,117.9 + ,86.1 + ,107.6 + ,117.3 + ,86 + ,106.7 + ,119.4 + ,84.5 + ,106.1 + ,117.1 + ,87.2 + ,106.3 + ,119 + ,83.5 + ,105.8 + ,120 + ,81.9 + ,104.4 + ,118.9 + ,78.5 + ,103.8 + ,116 + ,81.1 + ,102.4 + ,115.6 + ,79.2 + ,103.3 + ,119.7 + ,80.9 + ,103.5 + ,119.7 + ,81.8 + ,104.5 + ,120.8 + ,79.4 + ,103.5 + ,120 + ,83.4 + ,103.9 + ,120.2 + ,81.1 + ,103.1 + ,121.7 + ,79.8 + ,102.2 + ,116.9 + ,79.7 + ,104.7 + ,122.4 + ,84 + ,105.9 + ,122.6 + ,83.7 + ,106.6 + ,123.7 + ,83.5 + ,106.6 + ,120.9 + ,83.6 + ,107.5 + ,124.2 + ,86 + ,107.2 + ,122.6 + ,86.8 + ,109 + ,125.7 + ,86.9 + ,108.4 + ,123.1 + ,89 + ,107 + ,122.2 + ,87.8 + ,108 + ,126.2 + ,86.8 + ,110.8 + ,124.4 + ,88.8 + ,110.9 + ,127.8 + ,85.9 + ,109.7 + ,124.2 + ,86.7 + ,111 + ,126.7 + ,87.9 + ,111.5 + ,126.1 + ,88.5 + ,111 + ,128.2 + ,88.7 + ,111.8 + ,130.4 + ,88.1 + ,111.4 + ,130.2 + ,85.7 + ,110.8 + ,129.2 + ,86.1 + ,111.9 + ,129.7 + ,85.7 + ,112.9 + ,131 + ,84.3 + ,111.8 + ,129.2 + ,86.4 + ,111 + ,131.1 + ,85.4 + ,112.3 + ,132.9 + ,86.9 + ,112.4 + ,135.2 + ,85.6 + ,111.1 + ,132.3 + ,86.4) + ,dim=c(3 + ,60) + ,dimnames=list(c('tot' + ,'food' + ,'text') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('tot','food','text'),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 = 232] |--[dendrogram w/ 2 branches and 22 members at h = 44.2] | |--[dendrogram w/ 2 branches and 11 members at h = 9.05] | | |--[dendrogram w/ 2 branches and 7 members at h = 3.67] | | | |--leaf "55" | | | `--[dendrogram w/ 2 branches and 6 members at h = 2.81] | | | |--leaf "46" | | | `--[dendrogram w/ 2 branches and 5 members at h = 2.18] | | | |--leaf "57" | | | `--[dendrogram w/ 2 branches and 4 members at h = 1.45] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.707] | | | | |--leaf "52" | | | | `--leaf "54" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.04] | | | |--leaf "53" | | | `--leaf "56" | | `--[dendrogram w/ 2 branches and 4 members at h = 4.53] | | |--leaf "59" | | `--[dendrogram w/ 2 branches and 3 members at h = 3.16] | | |--leaf "51" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.43] | | |--leaf "58" | | `--leaf "60" | `--[dendrogram w/ 2 branches and 11 members at h = 12.5] | |--[dendrogram w/ 2 branches and 4 members at h = 3.26] | | |--leaf "45" | | `--[dendrogram w/ 2 branches and 3 members at h = 2.25] | | |--leaf "50" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.985] | | |--leaf "48" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 7 members at h = 6.66] | |--[dendrogram w/ 2 branches and 4 members at h = 2.69] | | |--[dendrogram w/ 2 branches and 2 members at h = 1.12] | | | |--leaf "41" | | | `--leaf "44" | | `--[dendrogram w/ 2 branches and 2 members at h = 2.31] | | |--leaf "39" | | `--leaf "47" | `--[dendrogram w/ 2 branches and 3 members at h = 2.71] | |--leaf "42" | `--[dendrogram w/ 2 branches and 2 members at h = 1.10] | |--leaf "40" | `--leaf "43" `--[dendrogram w/ 2 branches and 38 members at h = 76] |--[dendrogram w/ 2 branches and 13 members at h = 13.9] | |--[dendrogram w/ 2 branches and 3 members at h = 5.87] | | |--leaf "1" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.93] | | |--leaf "2" | | `--leaf "4" | `--[dendrogram w/ 2 branches and 10 members at h = 12.4] | |--[dendrogram w/ 2 branches and 7 members at h = 3.95] | | |--[dendrogram w/ 2 branches and 2 members at h = 2.21] | | | |--leaf "11" | | | `--leaf "13" | | `--[dendrogram w/ 2 branches and 5 members at h = 3.32] | | |--[dendrogram w/ 2 branches and 3 members at h = 1.57] | | | |--leaf "8" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.27] | | | |--leaf "6" | | | `--leaf "7" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.86] | | |--leaf "10" | | `--leaf "12" | `--[dendrogram w/ 2 branches and 3 members at h = 4.96] | |--leaf "9" | `--[dendrogram w/ 2 branches and 2 members at h = 2.20] | |--leaf "3" | `--leaf "5" `--[dendrogram w/ 2 branches and 25 members at h = 29.5] |--[dendrogram w/ 2 branches and 10 members at h = 11.9] | |--[dendrogram w/ 2 branches and 3 members at h = 2.67] | | |--leaf "26" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.41] | | |--leaf "27" | | `--leaf "34" | `--[dendrogram w/ 2 branches and 7 members at h = 5.8] | |--[dendrogram w/ 2 branches and 4 members at h = 2.8] | | |--leaf "31" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.978] | | |--leaf "29" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.806] | | |--leaf "28" | | `--leaf "32" | `--[dendrogram w/ 2 branches and 3 members at h = 3.07] | |--leaf "25" | `--[dendrogram w/ 2 branches and 2 members at h = 1.71] | |--leaf "30" | `--leaf "33" `--[dendrogram w/ 2 branches and 15 members at h = 19.9] |--[dendrogram w/ 2 branches and 8 members at h = 6.45] | |--[dendrogram w/ 2 branches and 3 members at h = 2.03] | | |--leaf "22" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.927] | | |--leaf "19" | | `--leaf "20" | `--[dendrogram w/ 2 branches and 5 members at h = 4.24] | |--[dendrogram w/ 2 branches and 2 members at h = 1.14] | | |--leaf "16" | | `--leaf "17" | `--[dendrogram w/ 2 branches and 3 members at h = 1.83] | |--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 0.768] | |--leaf "15" | `--leaf "18" `--[dendrogram w/ 2 branches and 7 members at h = 7.43] |--[dendrogram w/ 2 branches and 3 members at h = 2.03] | |--leaf "37" | `--[dendrogram w/ 2 branches and 2 members at h = 1.25] | |--leaf "35" | `--leaf "36" `--[dendrogram w/ 2 branches and 4 members at h = 2.62] |--leaf "24" `--[dendrogram w/ 2 branches and 3 members at h = 2.07] |--leaf "38" `--[dendrogram w/ 2 branches and 2 members at h = 1.15] |--leaf "21" `--leaf "23" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1m8711226430807.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/29iya1226430807.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/3l6t61226430807.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/4061x1226430807.tab") + } > > system("convert tmp/1m8711226430807.ps tmp/1m8711226430807.png") > system("convert tmp/29iya1226430807.ps tmp/29iya1226430807.png") convert: unable to open image `tmp/29iya1226430807.ps': No such file or directory. convert: missing an image filename `tmp/29iya1226430807.png'. > > > proc.time() user system elapsed 0.792 0.218 0.916