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(10030 + ,17471 + ,46737 + ,9536 + ,14968 + ,44737 + ,9953 + ,15449 + ,47557 + ,9775 + ,17582 + ,51261 + ,9843 + ,18501 + ,55457 + ,9461 + ,17291 + ,56659 + ,9230 + ,16465 + ,58609 + ,8956 + ,17109 + ,59382 + ,9608 + ,18438 + ,61773 + ,9482 + ,16944 + ,63957 + ,9962 + ,16362 + ,68596 + ,9766 + ,16965 + ,72177 + ,10312 + ,18937 + ,75406 + ,10032 + ,17842 + ,76166 + ,10411 + ,16187 + ,79315 + ,10438 + ,17655 + ,81498 + ,10803 + ,19194 + ,83580 + ,10365 + ,18400 + ,84371 + ,10488 + ,17436 + ,87196 + ,9698 + ,19526 + ,88097 + ,10087 + ,21304 + ,89233 + ,9769 + ,18947 + ,89191 + ,10381 + ,18786 + ,91690 + ,10117 + ,24304 + ,91379 + ,10775 + ,23724 + ,93150 + ,10735 + ,23823 + ,93809 + ,11601 + ,21433 + ,95112 + ,10749 + ,23900 + ,92812 + ,11227 + ,25432 + ,91524 + ,10904 + ,23619 + ,89082 + ,11418 + ,23761 + ,89984 + ,10429 + ,23844 + ,87307 + ,10755 + ,26374 + ,87683 + ,9566 + ,24406 + ,87339 + ,6849 + ,24752 + ,94868 + ,7210 + ,26005 + ,97006 + ,8472 + ,27758 + ,97832 + ,9334 + ,25534 + ,97888 + ,9523 + ,26415 + ,107411 + ,9622 + ,28217 + ,115751 + ,10215 + ,29101 + ,118399 + ,10752 + ,27715 + ,119545 + ,11766 + ,27622 + ,125345 + ,11816 + ,29065 + ,129831 + ,12730 + ,31450 + ,132645 + ,13481 + ,29571 + ,132924 + ,14905 + ,30996 + ,140225 + ,14571 + ,30937 + ,143589 + ,15308 + ,34106 + ,146909 + ,15870 + ,32851 + ,145038 + ,15950 + ,36114 + ,148559 + ,16350 + ,34383 + ,152418 + ,17086 + ,38077 + ,153209 + ,17668 + ,35638 + ,149805 + ,17947 + ,35254 + ,150299 + ,18322 + ,36683 + ,144756 + ,18696 + ,38977 + ,144677 + ,18772 + ,34951 + ,140757 + ,18947 + ,34177 + ,141650 + ,19142 + ,35299 + ,142721 + ,19724 + ,36419 + ,140737) + ,dim=c(3 + ,61) + ,dimnames=list(c('X' + ,'Y' + ,'Z') + ,1:61)) > y <- array(NA,dim=c(3,61),dimnames=list(c('X','Y','Z'),1:61)) > 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 61 members at h = 1247153] |--[dendrogram w/ 2 branches and 23 members at h = 175571] | |--[dendrogram w/ 2 branches and 15 members at h = 32975] | | |--[dendrogram w/ 2 branches and 5 members at h = 5694] | | | |--[dendrogram w/ 2 branches and 3 members at h = 3078] | | | | |--leaf "51" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 685] | | | | |--leaf "54" | | | | `--leaf "55" | | | `--[dendrogram w/ 2 branches and 2 members at h = 3849] | | | |--leaf "52" | | | `--leaf "53" | | `--[dendrogram w/ 2 branches and 10 members at h = 17029] | | |--[dendrogram w/ 2 branches and 4 members at h = 7153] | | | |--[dendrogram w/ 2 branches and 2 members at h = 2322] | | | | |--leaf "49" | | | | `--leaf "50" | | | `--[dendrogram w/ 2 branches and 2 members at h = 3381] | | | |--leaf "47" | | | `--leaf "48" | | `--[dendrogram w/ 2 branches and 6 members at h = 8404] | | |--[dendrogram w/ 2 branches and 2 members at h = 2326] | | | |--leaf "56" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 4 members at h = 2524] | | |--leaf "61" | | `--[dendrogram w/ 2 branches and 3 members at h = 1996] | | |--leaf "60" | | `--[dendrogram w/ 2 branches and 2 members at h = 1195] | | |--leaf "58" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 8 members at h = 43241] | |--[dendrogram w/ 2 branches and 4 members at h = 8946] | | |--leaf "43" | | `--[dendrogram w/ 2 branches and 3 members at h = 4219] | | |--leaf "44" | | `--[dendrogram w/ 2 branches and 2 members at h = 2043] | | |--leaf "45" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 4 members at h = 14612] | |--leaf "39" | `--[dendrogram w/ 2 branches and 3 members at h = 3937] | |--leaf "40" | `--[dendrogram w/ 2 branches and 2 members at h = 1877] | |--leaf "41" | `--leaf "42" `--[dendrogram w/ 2 branches and 38 members at h = 367277] |--[dendrogram w/ 2 branches and 10 members at h = 41436] | |--[dendrogram w/ 2 branches and 4 members at h = 6535] | | |--leaf "4" | | `--[dendrogram w/ 2 branches and 3 members at h = 3361] | | |--leaf "2" | | `--[dendrogram w/ 2 branches and 2 members at h = 2183] | | |--leaf "1" | | `--leaf "3" | `--[dendrogram w/ 2 branches and 6 members at h = 10295] | |--[dendrogram w/ 2 branches and 2 members at h = 2649] | | |--leaf "9" | | `--leaf "10" | `--[dendrogram w/ 2 branches and 4 members at h = 5088] | |--[dendrogram w/ 2 branches and 2 members at h = 1043] | | |--leaf "7" | | `--leaf "8" | `--[dendrogram w/ 2 branches and 2 members at h = 1748] | |--leaf "5" | `--leaf "6" `--[dendrogram w/ 2 branches and 28 members at h = 108358] |--[dendrogram w/ 2 branches and 8 members at h = 25064] | |--[dendrogram w/ 2 branches and 4 members at h = 6251] | | |--[dendrogram w/ 2 branches and 2 members at h = 1203] | | | |--leaf "17" | | | `--leaf "18" | | `--[dendrogram w/ 2 branches and 2 members at h = 2631] | | |--leaf "15" | | `--leaf "16" | `--[dendrogram w/ 2 branches and 4 members at h = 8960] | |--[dendrogram w/ 2 branches and 2 members at h = 1362] | | |--leaf "13" | | `--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 3637] | |--leaf "11" | `--leaf "12" `--[dendrogram w/ 2 branches and 20 members at h = 34760] |--[dendrogram w/ 2 branches and 8 members at h = 15135] | |--[dendrogram w/ 2 branches and 4 members at h = 4333] | | |--leaf "35" | | `--[dendrogram w/ 2 branches and 3 members at h = 2385] | | |--leaf "38" | | `--[dendrogram w/ 2 branches and 2 members at h = 2313] | | |--leaf "36" | | `--leaf "37" | `--[dendrogram w/ 2 branches and 4 members at h = 4390] | |--leaf "27" | `--[dendrogram w/ 2 branches and 3 members at h = 984] | |--leaf "26" | `--[dendrogram w/ 2 branches and 2 members at h = 382] | |--leaf "25" | `--leaf "28" `--[dendrogram w/ 2 branches and 12 members at h = 19913] |--[dendrogram w/ 2 branches and 5 members at h = 4297] | |--leaf "23" | `--[dendrogram w/ 2 branches and 4 members at h = 3741] | |--leaf "19" | `--[dendrogram w/ 2 branches and 3 members at h = 2603] | |--leaf "21" | `--[dendrogram w/ 2 branches and 2 members at h = 1240] | |--leaf "20" | `--leaf "22" `--[dendrogram w/ 2 branches and 7 members at h = 7242] |--[dendrogram w/ 2 branches and 3 members at h = 2925] | |--leaf "33" | `--[dendrogram w/ 2 branches and 2 members at h = 1030] | |--leaf "32" | `--leaf "34" `--[dendrogram w/ 2 branches and 4 members at h = 3604] |--[dendrogram w/ 2 branches and 2 members at h = 1048] | |--leaf "30" | `--leaf "31" `--[dendrogram w/ 2 branches and 2 members at h = 1589] |--leaf "24" `--leaf "29" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1ikby1226419703.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/2825d1226419703.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/39d141226419703.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/4kf481226419703.tab") + } > > system("convert tmp/1ikby1226419703.ps tmp/1ikby1226419703.png") > system("convert tmp/2825d1226419703.ps tmp/2825d1226419703.png") convert: unable to open image `tmp/2825d1226419703.ps': No such file or directory. convert: missing an image filename `tmp/2825d1226419703.png'. > > > proc.time() user system elapsed 0.803 0.217 1.119