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(3353 + ,2341 + ,820 + ,3480 + ,2540 + ,829 + ,3098 + ,2371 + ,677 + ,2944 + ,2122 + ,720 + ,3389 + ,2301 + ,846 + ,3497 + ,2512 + ,842 + ,4404 + ,3145 + ,1137 + ,3849 + ,2741 + ,961 + ,3734 + ,2548 + ,1008 + ,3060 + ,1987 + ,872 + ,3507 + ,2281 + ,1094 + ,3287 + ,2016 + ,905 + ,3215 + ,2434 + ,622 + ,3764 + ,2637 + ,1068 + ,2734 + ,1831 + ,760 + ,2837 + ,1851 + ,809 + ,2766 + ,1839 + ,838 + ,3851 + ,2609 + ,1008 + ,3289 + ,2417 + ,838 + ,3848 + ,2394 + ,1057 + ,3348 + ,2372 + ,904 + ,3682 + ,2717 + ,803 + ,4058 + ,2998 + ,810 + ,3655 + ,2538 + ,992 + ,3811 + ,3007 + ,667 + ,3341 + ,2475 + ,803 + ,3032 + ,2175 + ,611 + ,3475 + ,2465 + ,712 + ,3353 + ,2279 + ,785 + ,3186 + ,2323 + ,599 + ,3902 + ,2746 + ,1008 + ,4164 + ,2601 + ,1136 + ,3499 + ,2486 + ,931 + ,4145 + ,2718 + ,1051 + ,3796 + ,2646 + ,956 + ,3711 + ,2551 + ,1006 + ,3949 + ,2712 + ,1077 + ,3740 + ,2606 + ,772 + ,3243 + ,2365 + ,679 + ,4407 + ,3533 + ,787 + ,4814 + ,3509 + ,1011 + ,3908 + ,2912 + ,701 + ,5250 + ,3599 + ,1269 + ,3937 + ,2719 + ,1007 + ,4004 + ,2869 + ,1013 + ,5560 + ,4085 + ,1209 + ,3922 + ,2686 + ,1036 + ,3759 + ,2545 + ,1084 + ,4138 + ,3071 + ,926 + ,4634 + ,3388 + ,1083 + ,3996 + ,2652 + ,912 + ,4308 + ,3190 + ,910 + ,4142 + ,2884 + ,886 + ,4429 + ,3295 + ,948 + ,5219 + ,3818 + ,1134 + ,4929 + ,3226 + ,1226 + ,5754 + ,3953 + ,1515 + ,5592 + ,3810 + ,1491 + ,4163 + ,2877 + ,1086 + ,4962 + ,3515 + ,1274 + ,5208 + ,3708 + ,1164 + ,4755 + ,3450 + ,1205 + ,4491 + ,3360 + ,966 + ,5732 + ,4110 + ,1462 + ,5730 + ,4384 + ,1134 + ,5024 + ,3729 + ,1141 + ,6056 + ,4263 + ,1676 + ,4901 + ,3505 + ,1166 + ,5353 + ,3674 + ,1492 + ,5578 + ,3911 + ,1413 + ,4618 + ,2951 + ,1287 + ,4724 + ,3317 + ,1206 + ,5011 + ,3417 + ,1054 + ,5298 + ,3498 + ,1236 + ,4143 + ,2768 + ,1069 + ,4617 + ,2899 + ,1264 + ,4727 + ,3171 + ,1318 + ,4207 + ,3004 + ,1093 + ,5112 + ,3481 + ,1495 + ,4190 + ,3016 + ,1121 + ,4098 + ,2595 + ,1342 + ,5071 + ,3509 + ,1335 + ,4177 + ,2833 + ,1261 + ,4598 + ,3125 + ,1317 + ,3757 + ,2556 + ,867 + ,5591 + ,3628 + ,1428 + ,4218 + ,2876 + ,1199 + ,3780 + ,2575 + ,961 + ,4336 + ,2903 + ,1195 + ,4870 + ,3438 + ,1225 + ,4422 + ,2926 + ,1282 + ,4727 + ,3068 + ,1629 + ,4459 + ,3015 + ,1187) + ,dim=c(3 + ,93) + ,dimnames=list(c('Bel' + ,'VL' + ,'WL') + ,1:93)) > y <- array(NA,dim=c(3,93),dimnames=list(c('Bel','VL','WL'),1:93)) > 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 = '3' > 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 93 members at h = 44633] |--[dendrogram w/ 2 branches and 38 members at h = 10608] | |--[dendrogram w/ 2 branches and 21 members at h = 2385] | | |--[dendrogram w/ 2 branches and 10 members at h = 981] | | | |--[dendrogram w/ 2 branches and 4 members at h = 453] | | | | |--leaf "92" | | | | `--[dendrogram w/ 2 branches and 3 members at h = 345] | | | | |--leaf "56" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 137] | | | | |--leaf "77" | | | | `--leaf "84" | | | `--[dendrogram w/ 2 branches and 6 members at h = 469] | | | |--[dendrogram w/ 2 branches and 2 members at h = 56.9] | | | | |--leaf "71" | | | | `--leaf "76" | | | `--[dendrogram w/ 2 branches and 4 members at h = 274] | | | |--[dendrogram w/ 2 branches and 2 members at h = 124] | | | | |--leaf "89" | | | | `--leaf "91" | | | `--[dendrogram w/ 2 branches and 2 members at h = 150] | | | |--leaf "7" | | | `--leaf "93" | | `--[dendrogram w/ 2 branches and 11 members at h = 1638] | | |--[dendrogram w/ 2 branches and 4 members at h = 379] | | | |--leaf "40" | | | `--[dendrogram w/ 2 branches and 3 members at h = 250] | | | |--leaf "52" | | | `--[dendrogram w/ 2 branches and 2 members at h = 91.6] | | | |--leaf "54" | | | `--leaf "63" | | `--[dendrogram w/ 2 branches and 7 members at h = 446] | | |--[dendrogram w/ 2 branches and 3 members at h = 188] | | | |--leaf "50" | | | `--[dendrogram w/ 2 branches and 2 members at h = 137] | | | |--leaf "62" | | | `--leaf "72" | | `--[dendrogram w/ 2 branches and 4 members at h = 248] | | |--[dendrogram w/ 2 branches and 2 members at h = 94.5] | | | |--leaf "68" | | | `--leaf "90" | | `--[dendrogram w/ 2 branches and 2 members at h = 222] | | |--leaf "41" | | `--leaf "73" | `--[dendrogram w/ 2 branches and 17 members at h = 3313] | |--[dendrogram w/ 2 branches and 8 members at h = 689] | | |--[dendrogram w/ 2 branches and 3 members at h = 250] | | | |--leaf "79" | | | `--[dendrogram w/ 2 branches and 2 members at h = 125] | | | |--leaf "60" | | | `--leaf "82" | | `--[dendrogram w/ 2 branches and 5 members at h = 457] | | |--[dendrogram w/ 2 branches and 2 members at h = 117] | | | |--leaf "43" | | | `--leaf "74" | | `--[dendrogram w/ 2 branches and 3 members at h = 229] | | |--leaf "66" | | `--[dendrogram w/ 2 branches and 2 members at h = 115] | | |--leaf "55" | | `--leaf "61" | `--[dendrogram w/ 2 branches and 9 members at h = 1185] | |--[dendrogram w/ 2 branches and 4 members at h = 354] | | |--[dendrogram w/ 2 branches and 2 members at h = 128] | | | |--leaf "58" | | | `--leaf "70" | | `--[dendrogram w/ 2 branches and 2 members at h = 251] | | |--leaf "69" | | `--leaf "86" | `--[dendrogram w/ 2 branches and 5 members at h = 727] | |--[dendrogram w/ 2 branches and 2 members at h = 352] | | |--leaf "46" | | `--leaf "65" | `--[dendrogram w/ 2 branches and 3 members at h = 530] | |--leaf "67" | `--[dendrogram w/ 2 branches and 2 members at h = 167] | |--leaf "57" | `--leaf "64" `--[dendrogram w/ 2 branches and 55 members at h = 14067] |--[dendrogram w/ 2 branches and 22 members at h = 2951] | |--[dendrogram w/ 2 branches and 11 members at h = 616] | | |--[dendrogram w/ 2 branches and 4 members at h = 209] | | | |--leaf "28" | | | `--[dendrogram w/ 2 branches and 3 members at h = 128] | | | |--leaf "33" | | | `--[dendrogram w/ 2 branches and 2 members at h = 35.2] | | | |--leaf "2" | | | `--leaf "6" | | `--[dendrogram w/ 2 branches and 7 members at h = 472] | | |--leaf "11" | | `--[dendrogram w/ 2 branches and 6 members at h = 247] | | |--[dendrogram w/ 2 branches and 3 members at h = 77] | | | |--leaf "29" | | | `--[dendrogram w/ 2 branches and 2 members at h = 59.8] | | | |--leaf "1" | | | `--leaf "5" | | `--[dendrogram w/ 2 branches and 3 members at h = 134] | | |--leaf "21" | | `--[dendrogram w/ 2 branches and 2 members at h = 85.4] | | |--leaf "19" | | `--leaf "26" | `--[dendrogram w/ 2 branches and 11 members at h = 1699] | |--[dendrogram w/ 2 branches and 3 members at h = 108] | | |--leaf "15" | | `--[dendrogram w/ 2 branches and 2 members at h = 77.6] | | |--leaf "16" | | `--leaf "17" | `--[dendrogram w/ 2 branches and 8 members at h = 926] | |--[dendrogram w/ 2 branches and 4 members at h = 155] | | |--leaf "3" | | `--[dendrogram w/ 2 branches and 3 members at h = 118] | | |--leaf "30" | | `--[dendrogram w/ 2 branches and 2 members at h = 93.8] | | |--leaf "13" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 4 members at h = 500] | |--[dendrogram w/ 2 branches and 2 members at h = 150] | | |--leaf "4" | | `--leaf "27" | `--[dendrogram w/ 2 branches and 2 members at h = 231] | |--leaf "10" | `--leaf "12" `--[dendrogram w/ 2 branches and 33 members at h = 3507] |--[dendrogram w/ 2 branches and 18 members at h = 1040] | |--[dendrogram w/ 2 branches and 6 members at h = 213] | | |--leaf "51" | | `--[dendrogram w/ 2 branches and 5 members at h = 141] | | |--leaf "8" | | `--[dendrogram w/ 2 branches and 4 members at h = 88.7] | | |--[dendrogram w/ 2 branches and 2 members at h = 44.2] | | | |--leaf "31" | | | `--leaf "44" | | `--[dendrogram w/ 2 branches and 2 members at h = 55.6] | | |--leaf "37" | | `--leaf "47" | `--[dendrogram w/ 2 branches and 12 members at h = 594] | |--[dendrogram w/ 2 branches and 3 members at h = 176] | | |--leaf "22" | | `--[dendrogram w/ 2 branches and 2 members at h = 109] | | |--leaf "38" | | `--leaf "85" | `--[dendrogram w/ 2 branches and 9 members at h = 313] | |--leaf "20" | `--[dendrogram w/ 2 branches and 8 members at h = 254] | |--[dendrogram w/ 2 branches and 3 members at h = 93] | | |--leaf "18" | | `--[dendrogram w/ 2 branches and 2 members at h = 73] | | |--leaf "35" | | `--leaf "88" | `--[dendrogram w/ 2 branches and 5 members at h = 183] | |--[dendrogram w/ 2 branches and 3 members at h = 85.8] | | |--leaf "24" | | `--[dendrogram w/ 2 branches and 2 members at h = 23.3] | | |--leaf "9" | | `--leaf "36" | `--[dendrogram w/ 2 branches and 2 members at h = 93.5] | |--leaf "14" | `--leaf "48" `--[dendrogram w/ 2 branches and 15 members at h = 1513] |--[dendrogram w/ 2 branches and 5 members at h = 574] | |--[dendrogram w/ 2 branches and 2 members at h = 140] | | |--leaf "25" | | `--leaf "42" | `--[dendrogram w/ 2 branches and 3 members at h = 182] | |--leaf "53" | `--[dendrogram w/ 2 branches and 2 members at h = 159] | |--leaf "23" | `--leaf "49" `--[dendrogram w/ 2 branches and 10 members at h = 626] |--[dendrogram w/ 2 branches and 2 members at h = 216] | |--leaf "32" | `--leaf "81" `--[dendrogram w/ 2 branches and 8 members at h = 461] |--[dendrogram w/ 2 branches and 4 members at h = 228] | |--leaf "45" | `--[dendrogram w/ 2 branches and 3 members at h = 166] | |--leaf "59" | `--[dendrogram w/ 2 branches and 2 members at h = 53.2] | |--leaf "34" | `--leaf "75" `--[dendrogram w/ 2 branches and 4 members at h = 340] |--[dendrogram w/ 2 branches and 2 members at h = 34.9] | |--leaf "78" | `--leaf "80" `--[dendrogram w/ 2 branches and 2 members at h = 85.9] |--leaf "83" `--leaf "87" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1ejuw1226403973.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/2hjvc1226403973.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) + } --[dendrogram w/ 2 branches and 3 members at h = 2045] |--leaf 2 `--[dendrogram w/ 2 branches and 2 members at h = 885] |--leaf 1 `--leaf 3 > > #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/3ekm51226403973.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/4w54y1226403973.tab") + } > > system("convert tmp/1ejuw1226403973.ps tmp/1ejuw1226403973.png") > system("convert tmp/2hjvc1226403973.ps tmp/2hjvc1226403973.png") > > > proc.time() user system elapsed 1.082 0.323 1.251