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(3.253 + ,11.836 + ,345 + ,6.06 + ,519164 + ,3.233 + ,11.85 + ,334 + ,5.983 + ,517009 + ,3.196 + ,11.897 + ,345 + ,6.11 + ,509933 + ,3.138 + ,12.082 + ,333 + ,6.143 + ,509127 + ,3.091 + ,11.936 + ,336 + ,6.093 + ,500857 + ,3.17 + ,11.928 + ,324 + ,6.148 + ,506971 + ,3.378 + ,12.646 + ,320 + ,6.464 + ,569323 + ,3.468 + ,12.747 + ,330 + ,6.532 + ,579714 + ,3.33 + ,12.447 + ,313 + ,6.321 + ,577992 + ,3.413 + ,12.445 + ,301 + ,6.23 + ,565464 + ,3.356 + ,12.257 + ,288 + ,6.176 + ,547344 + ,3.525 + ,12.878 + ,294 + ,6.338 + ,554788 + ,3.633 + ,13.69 + ,302 + ,6.462 + ,562325 + ,3.597 + ,13.665 + ,294 + ,6.401 + ,560854 + ,3.6 + ,13.78 + ,293 + ,6.46 + ,555332 + ,3.522 + ,13.608 + ,290 + ,6.519 + ,543599 + ,3.503 + ,13.375 + ,283 + ,6.542 + ,536662 + ,3.532 + ,13.376 + ,286 + ,6.637 + ,542722 + ,3.686 + ,13.918 + ,293 + ,7.114 + ,593530 + ,3.748 + ,14.304 + ,334 + ,7.579 + ,610763 + ,3.672 + ,13.877 + ,329 + ,7.408 + ,612613 + ,3.843 + ,14.543 + ,411 + ,8.243 + ,611324 + ,3.905 + ,14.291 + ,416 + ,8.243 + ,594167 + ,3.999 + ,14.788 + ,418 + ,8.434 + ,595454 + ,4.07 + ,15.241 + ,408 + ,8.576 + ,590865 + ,4.084 + ,15.265 + ,402 + ,8.58 + ,589379 + ,4.042 + ,15.322 + ,401 + ,8.645 + ,584428 + ,3.951 + ,15.175 + ,400 + ,8.66 + ,573100 + ,3.933 + ,14.817 + ,389 + ,8.72 + ,567456 + ,3.958 + ,14.579 + ,371 + ,8.787 + ,569028 + ,4.147 + ,15.247 + ,364 + ,9.162 + ,620735 + ,4.221 + ,15.385 + ,350 + ,9.144 + ,628884 + ,4.058 + ,14.891 + ,332 + ,8.806 + ,628232 + ,4.057 + ,14.766 + ,323 + ,8.778 + ,612117 + ,4.089 + ,14.42 + ,316 + ,8.66 + ,595404 + ,4.268 + ,14.85 + ,312 + ,8.826 + ,597141 + ,4.309 + ,15.117 + ,315 + ,8.609 + ,593408 + ,4.303 + ,15.352 + ,314 + ,8.628 + ,590072 + ,4.177 + ,15.099 + ,313 + ,8.619 + ,579799 + ,4.117 + ,15.291 + ,314 + ,8.775 + ,574205 + ,4.065 + ,15.208 + ,317 + ,8.84 + ,572775 + ,3.983 + ,14.995 + ,308 + ,8.745 + ,572942 + ,4.091 + ,15.454 + ,312 + ,9.092 + ,619567 + ,4.067 + ,15.251 + ,306 + ,8.934 + ,625809 + ,4.024 + ,14.975 + ,304 + ,8.749 + ,619916 + ,3.868 + ,14.005 + ,297 + ,8.298 + ,587625 + ,3.8 + ,13.55 + ,284 + ,8.067 + ,565742 + ,3.804 + ,13.422 + ,278 + ,7.969 + ,557274 + ,3.862 + ,13.848 + ,273 + ,7.999 + ,560576 + ,3.792 + ,13.376 + ,265 + ,7.865 + ,548854 + ,3.674 + ,13.038 + ,259 + ,7.746 + ,531673 + ,3.56 + ,12.974 + ,252 + ,7.633 + ,525919 + ,3.489 + ,12.554 + ,245 + ,7.458 + ,511038 + ,3.412 + ,11.971 + ,235 + ,7.391 + ,498662 + ,3.674 + ,12.916 + ,232 + ,7.856 + ,555362 + ,3.672 + ,12.757 + ,229 + ,7.72 + ,564591 + ,3.463 + ,11.924 + ,219 + ,7.297 + ,541657 + ,3.429 + ,11.693 + ,218 + ,7.123 + ,527070 + ,3.4 + ,11.382 + ,215 + ,7.004 + ,509846 + ,3.533 + ,11.821 + ,211 + ,7.151 + ,514258) + ,dim=c(5 + ,60) + ,dimnames=list(c('landbouw' + ,'voeding' + ,'tabak' + ,'textiel' + ,'totaal') + ,1:60)) > y <- array(NA,dim=c(5,60),dimnames=list(c('landbouw','voeding','tabak','textiel','totaal'),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 = 1071642] |--[dendrogram w/ 2 branches and 19 members at h = 197028] | |--[dendrogram w/ 2 branches and 10 members at h = 30991] | | |--[dendrogram w/ 2 branches and 2 members at h = 2197] | | | |--leaf "5" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 8 members at h = 21069] | | |--[dendrogram w/ 2 branches and 5 members at h = 4235] | | | |--leaf "6" | | | `--[dendrogram w/ 2 branches and 4 members at h = 1826] | | | |--leaf "53" | | | `--[dendrogram w/ 2 branches and 3 members at h = 971] | | | |--leaf "4" | | | `--[dendrogram w/ 2 branches and 2 members at h = 156] | | | |--leaf "3" | | | `--leaf "59" | | `--[dendrogram w/ 2 branches and 3 members at h = 4389] | | |--leaf "60" | | `--[dendrogram w/ 2 branches and 2 members at h = 2155] | | |--leaf "1" | | `--leaf "2" | `--[dendrogram w/ 2 branches and 9 members at h = 47470] | |--[dendrogram w/ 2 branches and 5 members at h = 11113] | | |--[dendrogram w/ 2 branches and 2 members at h = 1510] | | | |--leaf "11" | | | `--leaf "50" | | `--[dendrogram w/ 2 branches and 3 members at h = 1715] | | |--leaf "57" | | `--[dendrogram w/ 2 branches and 2 members at h = 877] | | |--leaf "16" | | `--leaf "18" | `--[dendrogram w/ 2 branches and 4 members at h = 12276] | |--[dendrogram w/ 2 branches and 2 members at h = 1152] | | |--leaf "52" | | `--leaf "58" | `--[dendrogram w/ 2 branches and 2 members at h = 4989] | |--leaf "17" | `--leaf "51" `--[dendrogram w/ 2 branches and 41 members at h = 516871] |--[dendrogram w/ 2 branches and 20 members at h = 83356] | |--[dendrogram w/ 2 branches and 7 members at h = 16126] | | |--[dendrogram w/ 2 branches and 3 members at h = 2054] | | | |--leaf "13" | | | `--[dendrogram w/ 2 branches and 2 members at h = 279] | | | |--leaf "14" | | | `--leaf "49" | | `--[dendrogram w/ 2 branches and 4 members at h = 2972] | | |--leaf "48" | | `--[dendrogram w/ 2 branches and 3 members at h = 725] | | |--leaf "12" | | `--[dendrogram w/ 2 branches and 2 members at h = 68] | | |--leaf "15" | | `--leaf "55" | `--[dendrogram w/ 2 branches and 13 members at h = 40319] | |--[dendrogram w/ 2 branches and 6 members at h = 7999] | | |--[dendrogram w/ 2 branches and 3 members at h = 1259] | | | |--leaf "56" | | | `--[dendrogram w/ 2 branches and 2 members at h = 279] | | | |--leaf "10" | | | `--leaf "47" | | `--[dendrogram w/ 2 branches and 3 members at h = 2194] | | |--leaf "29" | | `--[dendrogram w/ 2 branches and 2 members at h = 299] | | |--leaf "7" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 7 members at h = 17934] | |--[dendrogram w/ 2 branches and 4 members at h = 1786] | | |--leaf "40" | | `--[dendrogram w/ 2 branches and 3 members at h = 290] | | |--leaf "28" | | `--[dendrogram w/ 2 branches and 2 members at h = 167] | | |--leaf "41" | | `--leaf "42" | `--[dendrogram w/ 2 branches and 3 members at h = 2324] | |--leaf "9" | `--[dendrogram w/ 2 branches and 2 members at h = 86.7] | |--leaf "8" | `--leaf "39" `--[dendrogram w/ 2 branches and 21 members at h = 222619] |--[dendrogram w/ 2 branches and 11 members at h = 24191] | |--[dendrogram w/ 2 branches and 6 members at h = 5205] | | |--[dendrogram w/ 2 branches and 3 members at h = 902] | | | |--leaf "23" | | | `--[dendrogram w/ 2 branches and 2 members at h = 124] | | | |--leaf "19" | | | `--leaf "37" | | `--[dendrogram w/ 2 branches and 3 members at h = 2247] | | |--leaf "36" | | `--[dendrogram w/ 2 branches and 2 members at h = 114] | | |--leaf "24" | | `--leaf "35" | `--[dendrogram w/ 2 branches and 5 members at h = 7077] | |--[dendrogram w/ 2 branches and 3 members at h = 1290] | | |--leaf "25" | | `--[dendrogram w/ 2 branches and 2 members at h = 699] | | |--leaf "26" | | `--leaf "38" | `--[dendrogram w/ 2 branches and 2 members at h = 3199] | |--leaf "27" | `--leaf "46" `--[dendrogram w/ 2 branches and 10 members at h = 46213] |--[dendrogram w/ 2 branches and 4 members at h = 2116] | |--[dendrogram w/ 2 branches and 2 members at h = 496] | | |--leaf "21" | | `--leaf "34" | `--[dendrogram w/ 2 branches and 2 members at h = 566] | |--leaf "20" | `--leaf "22" `--[dendrogram w/ 2 branches and 6 members at h = 19877] |--[dendrogram w/ 2 branches and 3 members at h = 1211] | |--leaf "31" | `--[dendrogram w/ 2 branches and 2 members at h = 349] | |--leaf "43" | `--leaf "45" `--[dendrogram w/ 2 branches and 3 members at h = 3448] |--leaf "44" `--[dendrogram w/ 2 branches and 2 members at h = 652] |--leaf "32" `--leaf "33" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1xz5a1226564636.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/297391226564636.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/3qyvi1226564637.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/4ayzk1226564637.tab") + } > > system("convert tmp/1xz5a1226564636.ps tmp/1xz5a1226564636.png") > system("convert tmp/297391226564636.ps tmp/297391226564636.png") convert: unable to open image `tmp/297391226564636.ps': No such file or directory. convert: missing an image filename `tmp/297391226564636.png'. > > > proc.time() user system elapsed 0.790 0.200 0.911