R version 2.7.0 (2008-04-22) 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(2218 + ,22780 + ,517 + ,1855 + ,17351 + ,525 + ,2187 + ,21382 + ,523 + ,1852 + ,24561 + ,519 + ,1570 + ,17409 + ,509 + ,1851 + ,11514 + ,512 + ,1954 + ,31514 + ,519 + ,1828 + ,27071 + ,517 + ,2251 + ,29462 + ,510 + ,2277 + ,26105 + ,509 + ,2085 + ,22397 + ,501 + ,2282 + ,23843 + ,507 + ,2266 + ,21705 + ,569 + ,1878 + ,18089 + ,580 + ,2267 + ,20764 + ,578 + ,2069 + ,25316 + ,565 + ,1746 + ,17704 + ,547 + ,2299 + ,15548 + ,555 + ,2360 + ,28029 + ,562 + ,2214 + ,29383 + ,561 + ,2825 + ,36438 + ,555 + ,2355 + ,32034 + ,544 + ,2333 + ,22679 + ,537 + ,3016 + ,24319 + ,543 + ,2155 + ,18004 + ,594 + ,2172 + ,17537 + ,611 + ,2150 + ,20366 + ,613 + ,2533 + ,22782 + ,611 + ,2058 + ,19169 + ,594 + ,2160 + ,13807 + ,595 + ,2259 + ,29743 + ,591 + ,2498 + ,25591 + ,589 + ,2695 + ,29096 + ,584 + ,2799 + ,26482 + ,573 + ,2945 + ,22405 + ,567 + ,2930 + ,27044 + ,569 + ,2318 + ,17970 + ,621 + ,2540 + ,18730 + ,629 + ,2570 + ,19684 + ,628 + ,2669 + ,19785 + ,612 + ,2450 + ,18479 + ,595 + ,2842 + ,10698 + ,597 + ,3439 + ,31956 + ,593 + ,2677 + ,29506 + ,590 + ,2979 + ,34506 + ,580 + ,2257 + ,27165 + ,574 + ,2842 + ,26736 + ,573 + ,2546 + ,23691 + ,573 + ,2455 + ,18157 + ,620 + ,2293 + ,17328 + ,626 + ,2379 + ,18205 + ,620 + ,2478 + ,20995 + ,588 + ,2054 + ,17382 + ,566 + ,2272 + ,9367 + ,557 + ,2351 + ,31124 + ,561 + ,2271 + ,26551 + ,549 + ,2542 + ,30651 + ,532 + ,2304 + ,25859 + ,526 + ,2194 + ,25100 + ,511 + ,2722 + ,25778 + ,499 + ,2395 + ,20418 + ,555 + ,2146 + ,18688 + ,565 + ,1894 + ,20424 + ,542 + ,2548 + ,24776 + ,527 + ,2087 + ,19814 + ,510 + ,2063 + ,12738 + ,514 + ,2481 + ,31566 + ,517 + ,2476 + ,30111 + ,508 + ,2212 + ,30019 + ,493 + ,2834 + ,31934 + ,490 + ,2148 + ,25826 + ,469 + ,2598 + ,26835 + ,478) + ,dim=c(3 + ,72) + ,dimnames=list(c('bouwverg' + ,'inschrNwagens' + ,'totwerkl') + ,1:72)) > y <- array(NA,dim=c(3,72),dimnames=list(c('bouwverg','inschrNwagens','totwerkl'),1:72)) > 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 72 members at h = 220411] |--[dendrogram w/ 2 branches and 31 members at h = 46113] | |--[dendrogram w/ 2 branches and 6 members at h = 7100] | | |--[dendrogram w/ 2 branches and 3 members at h = 1996] | | | |--leaf "54" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1287] | | | |--leaf "6" | | | `--leaf "42" | | `--[dendrogram w/ 2 branches and 3 members at h = 2686] | | |--leaf "18" | | `--[dendrogram w/ 2 branches and 2 members at h = 1076] | | |--leaf "30" | | `--leaf "66" | `--[dendrogram w/ 2 branches and 25 members at h = 21195] | |--[dendrogram w/ 2 branches and 14 members at h = 3977] | | |--[dendrogram w/ 2 branches and 6 members at h = 919] | | | |--[dendrogram w/ 2 branches and 3 members at h = 263] | | | | |--leaf "50" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 200] | | | | |--leaf "26" | | | | `--leaf "53" | | | `--[dendrogram w/ 2 branches and 3 members at h = 380] | | | |--leaf "17" | | | `--[dendrogram w/ 2 branches and 2 members at h = 291] | | | |--leaf "2" | | | `--leaf "5" | | `--[dendrogram w/ 2 branches and 8 members at h = 1406] | | |--[dendrogram w/ 2 branches and 3 members at h = 425] | | | |--leaf "62" | | | `--[dendrogram w/ 2 branches and 2 members at h = 269] | | | |--leaf "38" | | | `--leaf "41" | | `--[dendrogram w/ 2 branches and 5 members at h = 601] | | |--leaf "14" | | `--[dendrogram w/ 2 branches and 4 members at h = 428] | | |--[dendrogram w/ 2 branches and 2 members at h = 89.9] | | | |--leaf "49" | | | `--leaf "51" | | `--[dendrogram w/ 2 branches and 2 members at h = 169] | | |--leaf "25" | | `--leaf "37" | `--[dendrogram w/ 2 branches and 11 members at h = 4029] | |--[dendrogram w/ 2 branches and 4 members at h = 953] | | |--[dendrogram w/ 2 branches and 2 members at h = 142] | | | |--leaf "39" | | | `--leaf "40" | | `--[dendrogram w/ 2 branches and 2 members at h = 651] | | |--leaf "29" | | `--leaf "65" | `--[dendrogram w/ 2 branches and 7 members at h = 2011] | |--[dendrogram w/ 2 branches and 2 members at h = 336] | | |--leaf "3" | | `--leaf "13" | `--[dendrogram w/ 2 branches and 5 members at h = 899] | |--[dendrogram w/ 2 branches and 2 members at h = 313] | | |--leaf "15" | | `--leaf "52" | `--[dendrogram w/ 2 branches and 3 members at h = 430] | |--leaf "63" | `--[dendrogram w/ 2 branches and 2 members at h = 257] | |--leaf "27" | `--leaf "61" `--[dendrogram w/ 2 branches and 41 members at h = 77866] |--[dendrogram w/ 2 branches and 16 members at h = 13662] | |--[dendrogram w/ 2 branches and 8 members at h = 1867] | | |--[dendrogram w/ 2 branches and 4 members at h = 772] | | | |--[dendrogram w/ 2 branches and 2 members at h = 101] | | | | |--leaf "9" | | | | `--leaf "20" | | | `--[dendrogram w/ 2 branches and 2 members at h = 410] | | | |--leaf "33" | | | `--leaf "44" | | `--[dendrogram w/ 2 branches and 4 members at h = 937] | | |--leaf "57" | | `--[dendrogram w/ 2 branches and 3 members at h = 395] | | |--leaf "31" | | `--[dendrogram w/ 2 branches and 2 members at h = 280] | | |--leaf "68" | | `--leaf "69" | `--[dendrogram w/ 2 branches and 8 members at h = 9026] | |--[dendrogram w/ 2 branches and 6 members at h = 1566] | | |--[dendrogram w/ 2 branches and 3 members at h = 571] | | | |--leaf "7" | | | `--[dendrogram w/ 2 branches and 2 members at h = 463] | | | |--leaf "55" | | | `--leaf "67" | | `--[dendrogram w/ 2 branches and 3 members at h = 971] | | |--leaf "43" | | `--[dendrogram w/ 2 branches and 2 members at h = 492] | | |--leaf "22" | | `--leaf "70" | `--[dendrogram w/ 2 branches and 2 members at h = 1938] | |--leaf "21" | `--leaf "45" `--[dendrogram w/ 2 branches and 25 members at h = 22130] |--[dendrogram w/ 2 branches and 13 members at h = 4546] | |--[dendrogram w/ 2 branches and 5 members at h = 781] | | |--[dendrogram w/ 2 branches and 2 members at h = 305] | | | |--leaf "32" | | | `--leaf "60" | | `--[dendrogram w/ 2 branches and 3 members at h = 316] | | |--leaf "10" | | `--[dendrogram w/ 2 branches and 2 members at h = 169] | | |--leaf "58" | | `--leaf "71" | `--[dendrogram w/ 2 branches and 8 members at h = 1795] | |--[dendrogram w/ 2 branches and 4 members at h = 491] | | |--leaf "36" | | `--[dendrogram w/ 2 branches and 3 members at h = 379] | | |--leaf "72" | | `--[dendrogram w/ 2 branches and 2 members at h = 258] | | |--leaf "34" | | `--leaf "47" | `--[dendrogram w/ 2 branches and 4 members at h = 1434] | |--leaf "19" | `--[dendrogram w/ 2 branches and 3 members at h = 718] | |--leaf "56" | `--[dendrogram w/ 2 branches and 2 members at h = 443] | |--leaf "8" | `--leaf "46" `--[dendrogram w/ 2 branches and 12 members at h = 7920] |--[dendrogram w/ 2 branches and 5 members at h = 955] | |--leaf "35" | `--[dendrogram w/ 2 branches and 4 members at h = 572] | |--leaf "11" | `--[dendrogram w/ 2 branches and 3 members at h = 326] | |--leaf "28" | `--[dendrogram w/ 2 branches and 2 members at h = 154] | |--leaf "1" | `--leaf "23" `--[dendrogram w/ 2 branches and 7 members at h = 2207] |--[dendrogram w/ 2 branches and 3 members at h = 865] | |--leaf "4" | `--[dendrogram w/ 2 branches and 2 members at h = 255] | |--leaf "16" | `--leaf "59" `--[dendrogram w/ 2 branches and 4 members at h = 1375] |--[dendrogram w/ 2 branches and 2 members at h = 312] | |--leaf "12" | `--leaf "48" `--[dendrogram w/ 2 branches and 2 members at h = 654] |--leaf "24" `--leaf "64" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/13nnl1226398388.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=10.666666666667) > 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/2mgmy1226398388.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=10.666666666667) + 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/351e81226398388.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/4p72t1226398388.tab") + } > > system("convert tmp/13nnl1226398388.ps tmp/13nnl1226398388.png") > system("convert tmp/2mgmy1226398388.ps tmp/2mgmy1226398388.png") convert: unable to open image `tmp/2mgmy1226398388.ps': No such file or directory. convert: missing an image filename `tmp/2mgmy1226398388.png'. > > > proc.time() user system elapsed 1.647 0.337 1.732