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(4.43,88.3,4.61,88.6,4.54,91,4.2,91.5,4.08,95.4,3.95,98.7,4.19,99.9,4.23,98.6,3.89,100.3,3.92,100.2,4.14,100.4,4.24,101.4,4.08,103,4.37,109.1,4.43,111.4,4.3,114.1,4.27,121.8,4.06,127.6,3.96,129.9,4.21,128,4.31,123.5,4.35,124,4.25,127.4,4.06,127.6,4,128.4,3.87,131.4,3.71,135.1,3.63,134,3.48,144.5,3.6,147.3,3.66,150.9,3.45,148.7,3.3,141.4,3.14,138.9,3.21,139.8,3.12,145.6,3.14,147.9,3.4,148.5,3.42,151.1,3.29,157.5,3.49,167.5,3.52,172.3,3.81,173.5,4.03,187.5,3.98,205.5,4.1,195.1,3.96,204.5,3.83,204.5,3.72,201.7,3.82,207,3.76,206.6,3.98,210.6,4.14,211.1,4,215,4.13,223.9,4.28,238.2,4.46,238.9,4.63,229.6,4.49,232.2,4.41,222.1,4.5,221.6,4.39,227.3,4.33,221,4.45,213.6,4.17,243.4,4.13,253.8,4.33,265.3,4.47,268.2,4.63,268.5,4.9,266.9),dim=c(2,70),dimnames=list(c('REN','TPIG'),1:70)) > y <- array(NA,dim=c(2,70),dimnames=list(c('REN','TPIG'),1:70)) > 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 70 members at h = 2415] |--[dendrogram w/ 2 branches and 30 members at h = 375] | |--[dendrogram w/ 2 branches and 15 members at h = 139] | | |--[dendrogram w/ 2 branches and 10 members at h = 27.3] | | | |--[dendrogram w/ 2 branches and 6 members at h = 5.58] | | | | |--leaf "49" | | | | `--[dendrogram w/ 2 branches and 5 members at h = 3.92] | | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.404] | | | | | |--leaf "50" | | | | | `--leaf "51" | | | | `--[dendrogram w/ 2 branches and 3 members at h = 1.30] | | | | |--leaf "45" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.13] | | | | |--leaf "47" | | | | `--leaf "48" | | | `--[dendrogram w/ 2 branches and 4 members at h = 5.93] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.525] | | | | |--leaf "52" | | | | `--leaf "53" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.47] | | | |--leaf "54" | | | `--leaf "64" | | `--[dendrogram w/ 2 branches and 5 members at h = 40.7] | | |--[dendrogram w/ 2 branches and 3 members at h = 6.8] | | | |--leaf "41" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.23] | | | |--leaf "42" | | | `--leaf "43" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.6] | | |--leaf "44" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 15 members at h = 170] | |--[dendrogram w/ 2 branches and 4 members at h = 3.54] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.34] | | | |--leaf "68" | | | `--leaf "69" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.7] | | |--leaf "67" | | `--leaf "70" | `--[dendrogram w/ 2 branches and 11 members at h = 64.9] | |--[dendrogram w/ 2 branches and 4 members at h = 18.7] | | |--leaf "66" | | `--[dendrogram w/ 2 branches and 3 members at h = 6.23] | | |--leaf "65" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.723] | | |--leaf "56" | | `--leaf "57" | `--[dendrogram w/ 2 branches and 7 members at h = 20.2] | |--[dendrogram w/ 2 branches and 4 members at h = 3.16] | | |--leaf "55" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.982] | | |--leaf "63" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.508] | | |--leaf "60" | | `--leaf "61" | `--[dendrogram w/ 2 branches and 3 members at h = 4.23] | |--leaf "59" | `--[dendrogram w/ 2 branches and 2 members at h = 2.31] | |--leaf "58" | `--leaf "62" `--[dendrogram w/ 2 branches and 40 members at h = 539] |--[dendrogram w/ 2 branches and 16 members at h = 55.4] | |--[dendrogram w/ 2 branches and 4 members at h = 5.14] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.35] | | | |--leaf "1" | | | `--leaf "2" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.605] | | |--leaf "3" | | `--leaf "4" | `--[dendrogram w/ 2 branches and 12 members at h = 43.2] | |--[dendrogram w/ 2 branches and 3 members at h = 4.37] | | |--leaf "16" | | `--[dendrogram w/ 2 branches and 2 members at h = 2.3] | | |--leaf "14" | | `--leaf "15" | `--[dendrogram w/ 2 branches and 9 members at h = 7.44] | |--leaf "5" | `--[dendrogram w/ 2 branches and 8 members at h = 5.14] | |--[dendrogram w/ 2 branches and 2 members at h = 1.61] | | |--leaf "12" | | `--leaf "13" | `--[dendrogram w/ 2 branches and 6 members at h = 3.62] | |--[dendrogram w/ 2 branches and 2 members at h = 0.297] | | |--leaf "6" | | `--leaf "8" | `--[dendrogram w/ 2 branches and 4 members at h = 0.591] | |--leaf "7" | `--[dendrogram w/ 2 branches and 3 members at h = 0.343] | |--leaf "11" | `--[dendrogram w/ 2 branches and 2 members at h = 0.104] | |--leaf "9" | `--leaf "10" `--[dendrogram w/ 2 branches and 24 members at h = 152] |--[dendrogram w/ 2 branches and 10 members at h = 18.1] | |--[dendrogram w/ 2 branches and 3 members at h = 2.43] | | |--leaf "17" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.502] | | |--leaf "21" | | `--leaf "22" | `--[dendrogram w/ 2 branches and 7 members at h = 6.51] | |--[dendrogram w/ 2 branches and 5 members at h = 1.22] | | |--[dendrogram w/ 2 branches and 3 members at h = 0.368] | | | |--leaf "23" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | | |--leaf "18" | | | `--leaf "24" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.452] | | |--leaf "20" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 2 members at h = 1.50] | |--leaf "19" | `--leaf "26" `--[dendrogram w/ 2 branches and 14 members at h = 50.2] |--[dendrogram w/ 2 branches and 5 members at h = 11.2] | |--[dendrogram w/ 2 branches and 2 members at h = 1.10] | | |--leaf "27" | | `--leaf "28" | `--[dendrogram w/ 2 branches and 3 members at h = 2.44] | |--leaf "33" | `--[dendrogram w/ 2 branches and 2 members at h = 0.903] | |--leaf "34" | `--leaf "35" `--[dendrogram w/ 2 branches and 9 members at h = 15.0] |--[dendrogram w/ 2 branches and 6 members at h = 6.55] | |--[dendrogram w/ 2 branches and 2 members at h = 1.16] | | |--leaf "29" | | `--leaf "36" | `--[dendrogram w/ 2 branches and 4 members at h = 1.59] | |--[dendrogram w/ 2 branches and 2 members at h = 0.206] | | |--leaf "32" | | `--leaf "38" | `--[dendrogram w/ 2 branches and 2 members at h = 0.756] | |--leaf "30" | `--leaf "37" `--[dendrogram w/ 2 branches and 3 members at h = 8.57] |--leaf "40" `--[dendrogram w/ 2 branches and 2 members at h = 0.312] |--leaf "31" `--leaf "39" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/11d2p1226314285.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/2jbnj1226314285.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/3bwfa1226314285.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/4inva1226314285.tab") + } > > system("convert tmp/11d2p1226314285.ps tmp/11d2p1226314285.png") > system("convert tmp/2jbnj1226314285.ps tmp/2jbnj1226314285.png") convert: unable to open image `tmp/2jbnj1226314285.ps': No such file or directory. convert: missing an image filename `tmp/2jbnj1226314285.png'. > > > proc.time() user system elapsed 0.849 0.202 0.956