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(62.2 + ,43.5 + ,200.7 + ,88.5 + ,37.7 + ,146.5 + ,93.3 + ,36.8 + ,143.6 + ,89.2 + ,24.4 + ,141.5 + ,101.3 + ,31.3 + ,137.5 + ,97 + ,43.9 + ,138.7 + ,102.2 + ,53.6 + ,135.5 + ,100.3 + ,48.9 + ,136.4 + ,78.2 + ,30.9 + ,112.1 + ,105.9 + ,31.8 + ,109 + ,119.9 + ,41.3 + ,123.8 + ,108 + ,43.7 + ,151.2 + ,77 + ,54.1 + ,139.2 + ,93.1 + ,47.8 + ,115.7 + ,109.5 + ,36.7 + ,147.6 + ,100.4 + ,30.8 + ,126.1 + ,99 + ,31.9 + ,122.8 + ,113.9 + ,61.7 + ,137.3 + ,102.1 + ,73 + ,142 + ,101.6 + ,64.7 + ,137.4 + ,84 + ,24.2 + ,89.4 + ,110.7 + ,33.9 + ,108 + ,111.6 + ,32.4 + ,117.7 + ,110.7 + ,63.2 + ,127.3 + ,73.1 + ,71.8 + ,121 + ,87.5 + ,60.4 + ,104.1 + ,109.6 + ,48 + ,119.5 + ,99.3 + ,44.5 + ,116.7 + ,92.1 + ,44.9 + ,96.1 + ,109.3 + ,70.9 + ,125 + ,94.5 + ,72.7 + ,118.8 + ,91.4 + ,59.5 + ,114.9 + ,82.9 + ,35.9 + ,79.3 + ,103.3 + ,40 + ,90.5 + ,96 + ,43.6 + ,87.8 + ,104.8 + ,57.2 + ,109.4 + ,65.8 + ,75.8 + ,88.9 + ,78.7 + ,57.7 + ,97.4 + ,100.3 + ,47.7 + ,112 + ,85 + ,42.3 + ,86.8 + ,94.5 + ,43 + ,82.9 + ,97.9 + ,68 + ,105.2 + ,91.9 + ,70.6 + ,89.1 + ,87.2 + ,54.2 + ,85.5 + ,84.4 + ,38.6 + ,87.1 + ,99.2 + ,40.3 + ,85.2 + ,105.4 + ,49.2 + ,88.2 + ,110.9 + ,68.5 + ,104 + ,69.8 + ,75.9 + ,96.4 + ,86.8 + ,63.2 + ,82.3 + ,106.7 + ,49.8 + ,114.1 + ,88.8 + ,37 + ,88.9 + ,96.9 + ,48.8 + ,93.6 + ,108.1 + ,74.9 + ,101.8 + ,93.7 + ,75.3 + ,96.6 + ,94.8 + ,66.9 + ,93.7 + ,79.8 + ,44.1 + ,68.4 + ,95.6 + ,39.8 + ,68.7 + ,107.9 + ,56.6 + ,81.2 + ,104.9 + ,77.1 + ,85.1 + ,61.9 + ,78.5 + ,75.4 + ,85.7 + ,70.6 + ,71.6 + ,92.4 + ,54.2 + ,83 + ,86.4 + ,47.2 + ,72.3 + ,99.3 + ,55.1 + ,90.2 + ,95.5 + ,74.5 + ,89 + ,97 + ,88 + ,84.9 + ,102.1 + ,80.8 + ,90.9 + ,77.8 + ,54.4 + ,46.6 + ,105.5 + ,55.2 + ,55.4 + ,113.2 + ,73.8 + ,88.7 + ,108.8 + ,85.3 + ,76 + ,66.9 + ,98.7 + ,76.9 + ,89.3 + ,86.1 + ,72.1 + ,93.6 + ,62.5 + ,90 + ,92 + ,58.6 + ,92.3 + ,99.5 + ,67 + ,78 + ,98.6 + ,88.4 + ,93.9 + ,94.6 + ,96.5 + ,84.5 + ,96.7 + ,87.1 + ,80.4 + ,75.3 + ,61.2 + ,60.5 + ,102.5 + ,62.5 + ,75.3 + ,115.1 + ,85.2 + ,91.5 + ,104.7 + ,101.7 + ,105.2 + ,71.4 + ,113.7 + ,92.7) + ,dim=c(3 + ,85) + ,dimnames=list(c('X1' + ,'X2' + ,'X3') + ,1:85)) > y <- array(NA,dim=c(3,85),dimnames=list(c('X1','X2','X3'),1:85)) > 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 85 members at h = 923] |--[dendrogram w/ 2 branches and 35 members at h = 203] | |--[dendrogram w/ 2 branches and 13 members at h = 84.9] | | |--[dendrogram w/ 2 branches and 6 members at h = 31.1] | | | |--[dendrogram w/ 2 branches and 2 members at h = 7.32] | | | | |--leaf "48" | | | | `--leaf "54" | | | `--[dendrogram w/ 2 branches and 4 members at h = 18.6] | | | |--[dendrogram w/ 2 branches and 2 members at h = 13.5] | | | | |--leaf "36" | | | | `--leaf "42" | | | `--[dendrogram w/ 2 branches and 2 members at h = 14.1] | | | |--leaf "31" | | | `--leaf "32" | | `--[dendrogram w/ 2 branches and 7 members at h = 68.9] | | |--[dendrogram w/ 2 branches and 5 members at h = 24] | | | |--[dendrogram w/ 2 branches and 2 members at h = 9.5] | | | | |--leaf "19" | | | | `--leaf "20" | | | `--[dendrogram w/ 2 branches and 3 members at h = 15.0] | | | |--leaf "18" | | | `--[dendrogram w/ 2 branches and 2 members at h = 8.16] | | | |--leaf "24" | | | `--leaf "30" | | `--[dendrogram w/ 2 branches and 2 members at h = 25.7] | | |--leaf "13" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 22 members at h = 176] | |--[dendrogram w/ 2 branches and 12 members at h = 49.3] | | |--[dendrogram w/ 2 branches and 5 members at h = 18.8] | | | |--[dendrogram w/ 2 branches and 2 members at h = 6.39] | | | | |--leaf "27" | | | | `--leaf "51" | | | `--[dendrogram w/ 2 branches and 3 members at h = 8.2] | | | |--leaf "14" | | | `--[dendrogram w/ 2 branches and 2 members at h = 5.77] | | | |--leaf "28" | | | `--leaf "39" | | `--[dendrogram w/ 2 branches and 7 members at h = 43.8] | | |--[dendrogram w/ 2 branches and 4 members at h = 23.6] | | | |--leaf "11" | | | `--[dendrogram w/ 2 branches and 3 members at h = 11.7] | | | |--leaf "23" | | | `--[dendrogram w/ 2 branches and 2 members at h = 5.33] | | | |--leaf "10" | | | `--leaf "22" | | `--[dendrogram w/ 2 branches and 3 members at h = 31.9] | | |--leaf "9" | | `--[dendrogram w/ 2 branches and 2 members at h = 3.75] | | |--leaf "16" | | `--leaf "17" | `--[dendrogram w/ 2 branches and 10 members at h = 112] | |--leaf "1" | `--[dendrogram w/ 2 branches and 9 members at h = 42.4] | |--[dendrogram w/ 2 branches and 4 members at h = 17.8] | | |--[dendrogram w/ 2 branches and 2 members at h = 5.68] | | | |--leaf "2" | | | `--leaf "3" | | `--[dendrogram w/ 2 branches and 2 members at h = 14.5] | | |--leaf "4" | | `--leaf "5" | `--[dendrogram w/ 2 branches and 5 members at h = 33.7] | |--[dendrogram w/ 2 branches and 2 members at h = 8.01] | | |--leaf "12" | | `--leaf "15" | `--[dendrogram w/ 2 branches and 3 members at h = 10.2] | |--leaf "6" | `--[dendrogram w/ 2 branches and 2 members at h = 5.15] | |--leaf "7" | `--leaf "8" `--[dendrogram w/ 2 branches and 50 members at h = 362] |--[dendrogram w/ 2 branches and 17 members at h = 144] | |--[dendrogram w/ 2 branches and 5 members at h = 43.4] | | |--leaf "85" | | `--[dendrogram w/ 2 branches and 4 members at h = 31.8] | | |--[dendrogram w/ 2 branches and 2 members at h = 8.5] | | | |--leaf "37" | | | `--leaf "49" | | `--[dendrogram w/ 2 branches and 2 members at h = 20.9] | | |--leaf "61" | | `--leaf "73" | `--[dendrogram w/ 2 branches and 12 members at h = 53.3] | |--[dendrogram w/ 2 branches and 5 members at h = 32] | | |--[dendrogram w/ 2 branches and 3 members at h = 11.3] | | | |--leaf "79" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.6] | | | |--leaf "67" | | | `--leaf "80" | | `--[dendrogram w/ 2 branches and 2 members at h = 15.9] | | |--leaf "62" | | `--leaf "74" | `--[dendrogram w/ 2 branches and 7 members at h = 37.3] | |--leaf "84" | `--[dendrogram w/ 2 branches and 6 members at h = 20.6] | |--[dendrogram w/ 2 branches and 3 members at h = 13.9] | | |--leaf "78" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.43] | | |--leaf "60" | | `--leaf "68" | `--[dendrogram w/ 2 branches and 3 members at h = 19] | |--leaf "72" | `--[dendrogram w/ 2 branches and 2 members at h = 11.9] | |--leaf "71" | `--leaf "83" `--[dendrogram w/ 2 branches and 33 members at h = 162] |--[dendrogram w/ 2 branches and 16 members at h = 57.3] | |--[dendrogram w/ 2 branches and 5 members at h = 27] | | |--[dendrogram w/ 2 branches and 2 members at h = 6.04] | | | |--leaf "77" | | | `--leaf "82" | | `--[dendrogram w/ 2 branches and 3 members at h = 12.4] | | |--leaf "59" | | `--[dendrogram w/ 2 branches and 2 members at h = 8.72] | | |--leaf "47" | | `--leaf "65" | `--[dendrogram w/ 2 branches and 11 members at h = 36.3] | |--[dendrogram w/ 2 branches and 6 members at h = 21.3] | | |--[dendrogram w/ 2 branches and 3 members at h = 8.23] | | | |--leaf "56" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.8] | | | |--leaf "75" | | | `--leaf "76" | | `--[dendrogram w/ 2 branches and 3 members at h = 9.49] | | |--leaf "55" | | `--[dendrogram w/ 2 branches and 2 members at h = 5.31] | | |--leaf "43" | | `--leaf "66" | `--[dendrogram w/ 2 branches and 5 members at h = 33.2] | |--[dendrogram w/ 2 branches and 2 members at h = 11.4] | | |--leaf "26" | | `--leaf "38" | `--[dendrogram w/ 2 branches and 3 members at h = 11.5] | |--leaf "50" | `--[dendrogram w/ 2 branches and 2 members at h = 5.77] | |--leaf "44" | `--leaf "63" `--[dendrogram w/ 2 branches and 17 members at h = 125] |--[dendrogram w/ 2 branches and 6 members at h = 42.0] | |--[dendrogram w/ 2 branches and 2 members at h = 15.7] | | |--leaf "69" | | `--leaf "81" | `--[dendrogram w/ 2 branches and 4 members at h = 33.9] | |--leaf "70" | `--[dendrogram w/ 2 branches and 3 members at h = 16.4] | |--leaf "58" | `--[dendrogram w/ 2 branches and 2 members at h = 8.27] | |--leaf "57" | `--leaf "64" `--[dendrogram w/ 2 branches and 11 members at h = 46.8] |--[dendrogram w/ 2 branches and 6 members at h = 19.5] | |--[dendrogram w/ 2 branches and 2 members at h = 6.67] | | |--leaf "29" | | `--leaf "53" | `--[dendrogram w/ 2 branches and 4 members at h = 10.9] | |--leaf "34" | `--[dendrogram w/ 2 branches and 3 members at h = 5.73] | |--leaf "46" | `--[dendrogram w/ 2 branches and 2 members at h = 5.16] | |--leaf "35" | `--leaf "41" `--[dendrogram w/ 2 branches and 5 members at h = 20.3] |--leaf "21" `--[dendrogram w/ 2 branches and 4 members at h = 12.3] |--leaf "33" `--[dendrogram w/ 2 branches and 3 members at h = 6.66] |--leaf "52" `--[dendrogram w/ 2 branches and 2 members at h = 3.76] |--leaf "40" `--leaf "45" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1pd8g1226516288.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/282fr1226516288.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/3eeqf1226516288.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/483tc1226516288.tab") + } > > system("convert tmp/1pd8g1226516288.ps tmp/1pd8g1226516288.png") > system("convert tmp/282fr1226516288.ps tmp/282fr1226516288.png") convert: unable to open image `tmp/282fr1226516288.ps': No such file or directory. convert: missing an image filename `tmp/282fr1226516288.png'. > > > proc.time() user system elapsed 0.895 0.213 1.063