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(2120.88 + ,9682.35 + ,10413.00 + ,29.08 + ,2174.56 + ,9762.12 + ,10709.00 + ,28.76 + ,2196.72 + ,10124.63 + ,10662.00 + ,29.59 + ,2350.44 + ,10540.05 + ,10570.00 + ,30.70 + ,2440.25 + ,10601.61 + ,10297.00 + ,30.52 + ,2408.64 + ,10323.73 + ,10635.00 + ,32.67 + ,2472.81 + ,10418.40 + ,10872.00 + ,33.19 + ,2407.60 + ,10092.96 + ,10296.00 + ,37.13 + ,2454.62 + ,10364.91 + ,10383.00 + ,35.54 + ,2448.05 + ,10152.09 + ,10431.00 + ,37.75 + ,2497.84 + ,10032.80 + ,10574.00 + ,41.84 + ,2645.64 + ,10204.59 + ,10653.00 + ,42.94 + ,2756.76 + ,10001.60 + ,10805.00 + ,49.14 + ,2849.27 + ,10411.75 + ,10872.00 + ,44.61 + ,2921.44 + ,10673.38 + ,10625.00 + ,40.22 + ,2981.85 + ,10539.51 + ,10407.00 + ,44.23 + ,3080.58 + ,10723.78 + ,10463.00 + ,45.85 + ,3106.22 + ,10682.06 + ,10556.00 + ,53.38 + ,3119.31 + ,10283.19 + ,10646.00 + ,53.26 + ,3061.26 + ,10377.18 + ,10702.00 + ,51.80 + ,3097.31 + ,10486.64 + ,11353.00 + ,55.30 + ,3161.69 + ,10545.38 + ,11346.00 + ,57.81 + ,3257.16 + ,10554.27 + ,11451.00 + ,63.96 + ,3277.01 + ,10532.54 + ,11964.00 + ,63.77 + ,3295.32 + ,10324.31 + ,12574.00 + ,59.15 + ,3363.99 + ,10695.25 + ,13031.00 + ,56.12 + ,3494.17 + ,10827.81 + ,13812.00 + ,57.42 + ,3667.03 + ,10872.48 + ,14544.00 + ,63.52 + ,3813.06 + ,10971.19 + ,14931.00 + ,61.71 + ,3917.96 + ,11145.65 + ,14886.00 + ,63.01 + ,3895.51 + ,11234.68 + ,16005.00 + ,68.18 + ,3801.06 + ,11333.88 + ,17064.00 + ,72.03 + ,3570.12 + ,10997.97 + ,15168.00 + ,69.75 + ,3701.61 + ,11036.89 + ,16050.00 + ,74.41 + ,3862.27 + ,11257.35 + ,15839.00 + ,74.33 + ,3970.10 + ,11533.59 + ,15137.00 + ,64.24 + ,4138.52 + ,11963.12 + ,14954.00 + ,60.03 + ,4199.75 + ,12185.15 + ,15648.00 + ,59.44 + ,4290.89 + ,12377.62 + ,15305.00 + ,62.50 + ,4443.91 + ,12512.89 + ,15579.00 + ,55.04 + ,4502.64 + ,12631.48 + ,16348.00 + ,58.34 + ,4356.98 + ,12268.53 + ,15928.00 + ,61.92 + ,4591.27 + ,12754.80 + ,16171.00 + ,67.65 + ,4696.96 + ,13407.75 + ,15937.00 + ,67.68 + ,4621.40 + ,13480.21 + ,15713.00 + ,70.30 + ,4562.84 + ,13673.28 + ,15594.00 + ,75.26 + ,4202.52 + ,13239.71 + ,15683.00 + ,71.44 + ,4296.49 + ,13557.69 + ,16438.00 + ,76.36 + ,4435.23 + ,13901.28 + ,17032.00 + ,81.71 + ,4105.18 + ,13200.58 + ,17696.00 + ,92.60 + ,4116.68 + ,13406.97 + ,17745.00 + ,90.60 + ,3844.49 + ,12538.12 + ,19394.00 + ,92.23 + ,3720.98 + ,12419.57 + ,20148.00 + ,94.09 + ,3674.40 + ,12193.88 + ,20108.00 + ,102.79 + ,3857.62 + ,12656.63 + ,18584.00 + ,109.65 + ,3801.06 + ,12812.48 + ,18441.00 + ,124.05 + ,3504.37 + ,12056.67 + ,18391.00 + ,132.69 + ,3032.60 + ,11322.38 + ,19178.00 + ,135.81 + ,3047.03 + ,11530.75 + ,18079.00 + ,116.07 + ,2962.34 + ,11114.08 + ,18483.00 + ,101.42) + ,dim=c(4 + ,60) + ,dimnames=list(c('x1' + ,'x2' + ,'x3' + ,'x4') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('x1','x2','x3','x4'),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 = 129969] |--[dendrogram w/ 2 branches and 24 members at h = 5478] | |--[dendrogram w/ 2 branches and 13 members at h = 1419] | | |--[dendrogram w/ 2 branches and 2 members at h = 311] | | | |--leaf "1" | | | `--leaf "2" | | `--[dendrogram w/ 2 branches and 11 members at h = 889] | | |--[dendrogram w/ 2 branches and 3 members at h = 337] | | | |--leaf "13" | | | `--[dendrogram w/ 2 branches and 2 members at h = 240] | | | |--leaf "11" | | | `--leaf "12" | | `--[dendrogram w/ 2 branches and 8 members at h = 776] | | |--[dendrogram w/ 2 branches and 4 members at h = 459] | | | |--leaf "3" | | | `--[dendrogram w/ 2 branches and 3 members at h = 330] | | | |--leaf "7" | | | `--[dendrogram w/ 2 branches and 2 members at h = 233] | | | |--leaf "4" | | | `--leaf "6" | | `--[dendrogram w/ 2 branches and 4 members at h = 541] | | |--[dendrogram w/ 2 branches and 2 members at h = 153] | | | |--leaf "8" | | | `--leaf "10" | | `--[dendrogram w/ 2 branches and 2 members at h = 252] | | |--leaf "5" | | `--leaf "9" | `--[dendrogram w/ 2 branches and 11 members at h = 3449] | |--[dendrogram w/ 2 branches and 4 members at h = 819] | | |--leaf "24" | | `--[dendrogram w/ 2 branches and 3 members at h = 199] | | |--leaf "23" | | `--[dendrogram w/ 2 branches and 2 members at h = 87.5] | | |--leaf "21" | | `--leaf "22" | `--[dendrogram w/ 2 branches and 7 members at h = 884] | |--[dendrogram w/ 2 branches and 4 members at h = 271] | | |--leaf "16" | | `--[dendrogram w/ 2 branches and 3 members at h = 252] | | |--leaf "15" | | `--[dendrogram w/ 2 branches and 2 members at h = 105] | | |--leaf "17" | | `--leaf "18" | `--[dendrogram w/ 2 branches and 3 members at h = 391] | |--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 124] | |--leaf "19" | `--leaf "20" `--[dendrogram w/ 2 branches and 36 members at h = 28767] |--[dendrogram w/ 2 branches and 9 members at h = 4015] | |--[dendrogram w/ 2 branches and 3 members at h = 978] | | |--leaf "52" | | `--[dendrogram w/ 2 branches and 2 members at h = 234] | | |--leaf "53" | | `--leaf "54" | `--[dendrogram w/ 2 branches and 6 members at h = 3012] | |--[dendrogram w/ 2 branches and 3 members at h = 951] | | |--leaf "57" | | `--[dendrogram w/ 2 branches and 2 members at h = 219] | | |--leaf "55" | | `--leaf "56" | `--[dendrogram w/ 2 branches and 3 members at h = 1037] | |--leaf "58" | `--[dendrogram w/ 2 branches and 2 members at h = 587] | |--leaf "59" | `--leaf "60" `--[dendrogram w/ 2 branches and 27 members at h = 18364] |--[dendrogram w/ 2 branches and 14 members at h = 5799] | |--[dendrogram w/ 2 branches and 4 members at h = 1841] | | |--[dendrogram w/ 2 branches and 2 members at h = 212] | | | |--leaf "50" | | | `--leaf "51" | | `--[dendrogram w/ 2 branches and 2 members at h = 700] | | |--leaf "48" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 10 members at h = 3315] | |--[dendrogram w/ 2 branches and 4 members at h = 662] | | |--leaf "47" | | `--[dendrogram w/ 2 branches and 3 members at h = 389] | | |--leaf "44" | | `--[dendrogram w/ 2 branches and 2 members at h = 234] | | |--leaf "45" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 6 members at h = 1563] | |--[dendrogram w/ 2 branches and 2 members at h = 233] | | |--leaf "41" | | `--leaf "43" | `--[dendrogram w/ 2 branches and 4 members at h = 608] | |--[dendrogram w/ 2 branches and 2 members at h = 332] | | |--leaf "38" | | `--leaf "42" | `--[dendrogram w/ 2 branches and 2 members at h = 342] | |--leaf "39" | `--leaf "40" `--[dendrogram w/ 2 branches and 13 members at h = 7833] |--[dendrogram w/ 2 branches and 3 members at h = 1238] | |--leaf "27" | `--[dendrogram w/ 2 branches and 2 members at h = 593] | |--leaf "25" | `--leaf "26" `--[dendrogram w/ 2 branches and 10 members at h = 4054] |--[dendrogram w/ 2 branches and 4 members at h = 1546] | |--leaf "32" | `--[dendrogram w/ 2 branches and 3 members at h = 360] | |--leaf "34" | `--[dendrogram w/ 2 branches and 2 members at h = 171] | |--leaf "31" | `--leaf "35" `--[dendrogram w/ 2 branches and 6 members at h = 1564] |--[dendrogram w/ 2 branches and 2 members at h = 496] | |--leaf "36" | `--leaf "37" `--[dendrogram w/ 2 branches and 4 members at h = 617] |--leaf "28" `--[dendrogram w/ 2 branches and 3 members at h = 472] |--leaf "33" `--[dendrogram w/ 2 branches and 2 members at h = 208] |--leaf "29" `--leaf "30" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1e0of1226446488.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/220rl1226446488.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/3m2wo1226446488.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/4jivs1226446488.tab") + } > > system("convert tmp/1e0of1226446488.ps tmp/1e0of1226446488.png") > system("convert tmp/220rl1226446488.ps tmp/220rl1226446488.png") convert: unable to open image `tmp/220rl1226446488.ps': No such file or directory. convert: missing an image filename `tmp/220rl1226446488.png'. > > > proc.time() user system elapsed 0.791 0.196 0.927