R version 2.8.0 (2008-10-20) 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(2120.88 + ,9682.35 + ,29.08 + ,2174.56 + ,9762.12 + ,28.76 + ,2196.72 + ,10124.63 + ,29.59 + ,2350.44 + ,10540.05 + ,30.70 + ,2440.25 + ,10601.61 + ,30.52 + ,2408.64 + ,10323.73 + ,32.67 + ,2472.81 + ,10418.40 + ,33.19 + ,2407.60 + ,10092.96 + ,37.13 + ,2454.62 + ,10364.91 + ,35.54 + ,2448.05 + ,10152.09 + ,37.75 + ,2497.84 + ,10032.80 + ,41.84 + ,2645.64 + ,10204.59 + ,42.94 + ,2756.76 + ,10001.60 + ,49.14 + ,2849.27 + ,10411.75 + ,44.61 + ,2921.44 + ,10673.38 + ,40.22 + ,2981.85 + ,10539.51 + ,44.23 + ,3080.58 + ,10723.78 + ,45.85 + ,3106.22 + ,10682.06 + ,53.38 + ,3119.31 + ,10283.19 + ,53.26 + ,3061.26 + ,10377.18 + ,51.80 + ,3097.31 + ,10486.64 + ,55.30 + ,3161.69 + ,10545.38 + ,57.81 + ,3257.16 + ,10554.27 + ,63.96 + ,3277.01 + ,10532.54 + ,63.77 + ,3295.32 + ,10324.31 + ,59.15 + ,3363.99 + ,10695.25 + ,56.12 + ,3494.17 + ,10827.81 + ,57.42 + ,3667.03 + ,10872.48 + ,63.52 + ,3813.06 + ,10971.19 + ,61.71 + ,3917.96 + ,11145.65 + ,63.01 + ,3895.51 + ,11234.68 + ,68.18 + ,3801.06 + ,11333.88 + ,72.03 + ,3570.12 + ,10997.97 + ,69.75 + ,3701.61 + ,11036.89 + ,74.41 + ,3862.27 + ,11257.35 + ,74.33 + ,3970.10 + ,11533.59 + ,64.24 + ,4138.52 + ,11963.12 + ,60.03 + ,4199.75 + ,12185.15 + ,59.44 + ,4290.89 + ,12377.62 + ,62.50 + ,4443.91 + ,12512.89 + ,55.04 + ,4502.64 + ,12631.48 + ,58.34 + ,4356.98 + ,12268.53 + ,61.92 + ,4591.27 + ,12754.80 + ,67.65 + ,4696.96 + ,13407.75 + ,67.68 + ,4621.40 + ,13480.21 + ,70.30 + ,4562.84 + ,13673.28 + ,75.26 + ,4202.52 + ,13239.71 + ,71.44 + ,4296.49 + ,13557.69 + ,76.36 + ,4435.23 + ,13901.28 + ,81.71 + ,4105.18 + ,13200.58 + ,92.60 + ,4116.68 + ,13406.97 + ,90.60 + ,3844.49 + ,12538.12 + ,92.23 + ,3720.98 + ,12419.57 + ,94.09 + ,3674.40 + ,12193.88 + ,102.79 + ,3857.62 + ,12656.63 + ,109.65 + ,3801.06 + ,12812.48 + ,124.05 + ,3504.37 + ,12056.67 + ,132.69 + ,3032.60 + ,11322.38 + ,135.81 + ,3047.03 + ,11530.75 + ,116.07 + ,2962.34 + ,11114.08 + ,101.42) + ,dim=c(3 + ,60) + ,dimnames=list(c('x1' + ,'x2' + ,'x3') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('x1','x2','x3'),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 = 46096] |--[dendrogram w/ 2 branches and 21 members at h = 7230] | |--[dendrogram w/ 2 branches and 8 members at h = 1317] | | |--[dendrogram w/ 2 branches and 3 members at h = 228] | | | |--leaf "51" | | | `--[dendrogram w/ 2 branches and 2 members at h = 107] | | | |--leaf "47" | | | `--leaf "50" | | `--[dendrogram w/ 2 branches and 5 members at h = 603] | | |--[dendrogram w/ 2 branches and 2 members at h = 105] | | | |--leaf "44" | | | `--leaf "45" | | `--[dendrogram w/ 2 branches and 3 members at h = 354] | | |--leaf "48" | | `--[dendrogram w/ 2 branches and 2 members at h = 261] | | |--leaf "46" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 13 members at h = 2576] | |--[dendrogram w/ 2 branches and 6 members at h = 1040] | | |--[dendrogram w/ 2 branches and 2 members at h = 221] | | | |--leaf "54" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 4 members at h = 330] | | |--leaf "56" | | `--[dendrogram w/ 2 branches and 3 members at h = 257] | | |--leaf "53" | | `--[dendrogram w/ 2 branches and 2 members at h = 121] | | |--leaf "52" | | `--leaf "55" | `--[dendrogram w/ 2 branches and 7 members at h = 1205] | |--[dendrogram w/ 2 branches and 3 members at h = 246] | | |--leaf "43" | | `--[dendrogram w/ 2 branches and 2 members at h = 132] | | |--leaf "40" | | `--leaf "41" | `--[dendrogram w/ 2 branches and 4 members at h = 437] | |--leaf "37" | `--[dendrogram w/ 2 branches and 3 members at h = 218] | |--leaf "38" | `--[dendrogram w/ 2 branches and 2 members at h = 128] | |--leaf "39" | `--leaf "42" `--[dendrogram w/ 2 branches and 39 members at h = 12362] |--[dendrogram w/ 2 branches and 14 members at h = 2620] | |--[dendrogram w/ 2 branches and 3 members at h = 362] | | |--leaf "60" | | `--[dendrogram w/ 2 branches and 2 members at h = 210] | | |--leaf "58" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 11 members at h = 1740] | |--[dendrogram w/ 2 branches and 5 members at h = 432] | | |--leaf "36" | | `--[dendrogram w/ 2 branches and 4 members at h = 185] | | |--leaf "32" | | `--[dendrogram w/ 2 branches and 3 members at h = 131] | | |--leaf "30" | | `--[dendrogram w/ 2 branches and 2 members at h = 40.7] | | |--leaf "31" | | `--leaf "35" | `--[dendrogram w/ 2 branches and 6 members at h = 619] | |--[dendrogram w/ 2 branches and 2 members at h = 186] | | |--leaf "26" | | `--leaf "27" | `--[dendrogram w/ 2 branches and 4 members at h = 219] | |--[dendrogram w/ 2 branches and 2 members at h = 130] | | |--leaf "29" | | `--leaf "34" | `--[dendrogram w/ 2 branches and 2 members at h = 159] | |--leaf "28" | `--leaf "33" `--[dendrogram w/ 2 branches and 25 members at h = 6292] |--[dendrogram w/ 2 branches and 12 members at h = 809] | |--[dendrogram w/ 2 branches and 5 members at h = 415] | | |--[dendrogram w/ 2 branches and 2 members at h = 49.5] | | | |--leaf "17" | | | `--leaf "18" | | `--[dendrogram w/ 2 branches and 3 members at h = 255] | | |--leaf "14" | | `--[dendrogram w/ 2 branches and 2 members at h = 147] | | |--leaf "15" | | `--leaf "16" | `--[dendrogram w/ 2 branches and 7 members at h = 470] | |--[dendrogram w/ 2 branches and 4 members at h = 228] | | |--[dendrogram w/ 2 branches and 2 members at h = 29.4] | | | |--leaf "23" | | | `--leaf "24" | | `--[dendrogram w/ 2 branches and 2 members at h = 87.2] | | |--leaf "21" | | `--leaf "22" | `--[dendrogram w/ 2 branches and 3 members at h = 244] | |--leaf "25" | `--[dendrogram w/ 2 branches and 2 members at h = 110] | |--leaf "19" | `--leaf "20" `--[dendrogram w/ 2 branches and 13 members at h = 1621] |--[dendrogram w/ 2 branches and 5 members at h = 394] | |--[dendrogram w/ 2 branches and 3 members at h = 98.6] | | |--leaf "6" | | `--[dendrogram w/ 2 branches and 2 members at h = 56.5] | | |--leaf "7" | | `--leaf "9" | `--[dendrogram w/ 2 branches and 2 members at h = 109] | |--leaf "4" | `--leaf "5" `--[dendrogram w/ 2 branches and 8 members at h = 1201] |--[dendrogram w/ 2 branches and 2 members at h = 96.2] | |--leaf "1" | `--leaf "2" `--[dendrogram w/ 2 branches and 6 members at h = 560] |--[dendrogram w/ 2 branches and 2 members at h = 231] | |--leaf "12" | `--leaf "13" `--[dendrogram w/ 2 branches and 4 members at h = 339] |--leaf "3" `--[dendrogram w/ 2 branches and 3 members at h = 135] |--leaf "11" `--[dendrogram w/ 2 branches and 2 members at h = 71.6] |--leaf "8" `--leaf "10" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1zosh1229340033.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/2wd7q1229340033.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/3rrbd1229340033.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/47u4q1229340033.tab") + } > > system("convert tmp/1zosh1229340033.ps tmp/1zosh1229340033.png") > system("convert tmp/2wd7q1229340033.ps tmp/2wd7q1229340033.png") convert: unable to open image `tmp/2wd7q1229340033.ps': No such file or directory. convert: missing an image filename `tmp/2wd7q1229340033.png'. > > > proc.time() user system elapsed 0.593 0.189 1.733