R version 2.6.0 (2007-10-03) Copyright (C) 2007 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(1178 + ,2529 + ,22 + ,476049 + ,2141 + ,2196 + ,27 + ,474605 + ,2238 + ,3202 + ,24 + ,470439 + ,2685 + ,2718 + ,24 + ,461251 + ,4341 + ,2728 + ,22 + ,454724 + ,5376 + ,2354 + ,23 + ,455626 + ,4478 + ,2697 + ,25 + ,516847 + ,6404 + ,2651 + ,23 + ,525192 + ,4617 + ,2067 + ,21 + ,522975 + ,3024 + ,2641 + ,21 + ,518585 + ,1897 + ,2539 + ,22 + ,509239 + ,2075 + ,2294 + ,20 + ,512238 + ,1351 + ,2712 + ,22 + ,519164 + ,2211 + ,2314 + ,22 + ,517009 + ,2453 + ,3092 + ,20 + ,509933 + ,3042 + ,2677 + ,21 + ,509127 + ,4765 + ,2813 + ,20 + ,500857 + ,4992 + ,2668 + ,21 + ,506971 + ,4601 + ,2939 + ,21 + ,569323 + ,6266 + ,2617 + ,21 + ,579714 + ,4812 + ,2231 + ,19 + ,577992 + ,3159 + ,2481 + ,21 + ,565464 + ,1916 + ,2421 + ,21 + ,547344 + ,2237 + ,2408 + ,22 + ,554788 + ,1595 + ,2560 + ,19 + ,562325 + ,2453 + ,2100 + ,24 + ,560854 + ,2226 + ,3315 + ,22 + ,555332 + ,3597 + ,2801 + ,22 + ,543599 + ,4706 + ,2403 + ,22 + ,536662 + ,4974 + ,3024 + ,24 + ,542722 + ,5756 + ,2507 + ,22 + ,593530 + ,5493 + ,2980 + ,23 + ,610763 + ,5004 + ,2211 + ,24 + ,612613 + ,3225 + ,2471 + ,21 + ,611324 + ,2006 + ,2594 + ,20 + ,594167 + ,2291 + ,2452 + ,22 + ,595454 + ,1588 + ,2232 + ,23 + ,590865 + ,2105 + ,2373 + ,23 + ,589379 + ,2191 + ,3127 + ,22 + ,584428 + ,3591 + ,2802 + ,20 + ,573100 + ,4668 + ,2641 + ,21 + ,567456 + ,4885 + ,2787 + ,21 + ,569028 + ,5822 + ,2619 + ,20 + ,620735 + ,5599 + ,2806 + ,20 + ,628884 + ,5340 + ,2193 + ,17 + ,628232 + ,3082 + ,2323 + ,18 + ,612117 + ,2010 + ,2529 + ,19 + ,595404 + ,2301 + ,2412 + ,19 + ,597141 + ,1514 + ,2262 + ,20 + ,593408 + ,1979 + ,2154 + ,21 + ,590072 + ,2480 + ,3230 + ,20 + ,579799 + ,3499 + ,2295 + ,21 + ,574205 + ,4676 + ,2715 + ,19 + ,572775 + ,5585 + ,2733 + ,22 + ,572942 + ,5610 + ,2317 + ,20 + ,619567 + ,5796 + ,2730 + ,18 + ,625809 + ,6199 + ,1913 + ,16 + ,619916 + ,3030 + ,2390 + ,17 + ,587625 + ,1930 + ,2484 + ,18 + ,565742 + ,2552 + ,1960 + ,19 + ,557274) + ,dim=c(4 + ,60) + ,dimnames=list(c('Huwlkn' + ,'Schdngen' + ,'Fin.sit.' + ,'Tot.werk. ') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('Huwlkn','Schdngen','Fin.sit.','Tot.werk. '),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: Wessa, P., (2007), Hierarchical Clustering (v1.0.1) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_hierarchicalclustering.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 = 1483488] |--[dendrogram w/ 2 branches and 18 members at h = 317411] | |--[dendrogram w/ 2 branches and 6 members at h = 41319] | | |--[dendrogram w/ 2 branches and 3 members at h = 6101] | | | |--leaf "3" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1767] | | | |--leaf "1" | | | `--leaf "2" | | `--[dendrogram w/ 2 branches and 3 members at h = 8179] | | |--leaf "4" | | `--[dendrogram w/ 2 branches and 2 members at h = 1423] | | |--leaf "5" | | `--leaf "6" | `--[dendrogram w/ 2 branches and 12 members at h = 48239] | |--[dendrogram w/ 2 branches and 6 members at h = 12919] | | |--leaf "17" | | `--[dendrogram w/ 2 branches and 5 members at h = 5476] | | |--leaf "18" | | `--[dendrogram w/ 2 branches and 4 members at h = 3834] | | |--leaf "12" | | `--[dendrogram w/ 2 branches and 3 members at h = 1144] | | |--leaf "16" | | `--[dendrogram w/ 2 branches and 2 members at h = 1047] | | |--leaf "11" | | `--leaf "15" | `--[dendrogram w/ 2 branches and 6 members at h = 14136] | |--[dendrogram w/ 2 branches and 2 members at h = 2907] | | |--leaf "8" | | `--leaf "9" | `--[dendrogram w/ 2 branches and 4 members at h = 3244] | |--leaf "7" | `--[dendrogram w/ 2 branches and 3 members at h = 2181] | |--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 1772] | |--leaf "10" | `--leaf "13" `--[dendrogram w/ 2 branches and 42 members at h = 553019] |--[dendrogram w/ 2 branches and 21 members at h = 126930] | |--[dendrogram w/ 2 branches and 10 members at h = 23708] | | |--[dendrogram w/ 2 branches and 3 members at h = 3872] | | | |--leaf "51" | | | `--[dendrogram w/ 2 branches and 2 members at h = 2287] | | | |--leaf "20" | | | `--leaf "21" | | `--[dendrogram w/ 2 branches and 7 members at h = 12736] | | |--[dendrogram w/ 2 branches and 3 members at h = 2178] | | | |--leaf "41" | | | `--[dendrogram w/ 2 branches and 2 members at h = 437] | | | |--leaf "19" | | | `--leaf "42" | | `--[dendrogram w/ 2 branches and 4 members at h = 2685] | | |--[dendrogram w/ 2 branches and 2 members at h = 924] | | | |--leaf "53" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 2 members at h = 1219] | | |--leaf "40" | | `--leaf "52" | `--[dendrogram w/ 2 branches and 11 members at h = 66808] | |--[dendrogram w/ 2 branches and 4 members at h = 10196] | | |--leaf "29" | | `--[dendrogram w/ 2 branches and 3 members at h = 5916] | | |--leaf "23" | | `--[dendrogram w/ 2 branches and 2 members at h = 1648] | | |--leaf "28" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 7 members at h = 20433] | |--[dendrogram w/ 2 branches and 3 members at h = 2938] | | |--leaf "60" | | `--[dendrogram w/ 2 branches and 2 members at h = 1058] | | |--leaf "24" | | `--leaf "27" | `--[dendrogram w/ 2 branches and 4 members at h = 6764] | |--[dendrogram w/ 2 branches and 2 members at h = 1260] | | |--leaf "22" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 2 members at h = 1764] | |--leaf "25" | `--leaf "26" `--[dendrogram w/ 2 branches and 21 members at h = 221313] |--[dendrogram w/ 2 branches and 11 members at h = 23161] | |--[dendrogram w/ 2 branches and 6 members at h = 5845] | | |--leaf "31" | | `--[dendrogram w/ 2 branches and 5 members at h = 3881] | | |--[dendrogram w/ 2 branches and 2 members at h = 964] | | | |--leaf "35" | | | `--leaf "49" | | `--[dendrogram w/ 2 branches and 3 members at h = 2203] | | |--leaf "48" | | `--[dendrogram w/ 2 branches and 2 members at h = 296] | | |--leaf "36" | | `--leaf "47" | `--[dendrogram w/ 2 branches and 5 members at h = 7303] | |--[dendrogram w/ 2 branches and 3 members at h = 1399] | | |--leaf "37" | | `--[dendrogram w/ 2 branches and 2 members at h = 738] | | |--leaf "38" | | `--leaf "50" | `--[dendrogram w/ 2 branches and 2 members at h = 3386] | |--leaf "39" | `--leaf "58" `--[dendrogram w/ 2 branches and 10 members at h = 45071] |--[dendrogram w/ 2 branches and 4 members at h = 3276] | |--[dendrogram w/ 2 branches and 2 members at h = 819] | | |--leaf "34" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 2 members at h = 2062] | |--leaf "32" | `--leaf "33" `--[dendrogram w/ 2 branches and 6 members at h = 19557] |--[dendrogram w/ 2 branches and 3 members at h = 1315] | |--leaf "43" | `--[dendrogram w/ 2 branches and 2 members at h = 795] | |--leaf "55" | `--leaf "57" `--[dendrogram w/ 2 branches and 3 members at h = 3427] |--leaf "56" `--[dendrogram w/ 2 branches and 2 members at h = 932] |--leaf "44" `--leaf "45" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/175zn1194293567.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/2s8xj1194293567.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) + } > 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/319qe1194293568.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/4mky11194293568.tab") + } > > system("convert tmp/175zn1194293567.ps tmp/175zn1194293567.png") > system("convert tmp/2s8xj1194293567.ps tmp/2s8xj1194293567.png") convert: unable to open image `tmp/2s8xj1194293567.ps': No such file or directory. convert: missing an image filename `tmp/2s8xj1194293567.png'. > > > proc.time() user system elapsed 0.863 0.210 0.958