R version 2.8.0 (2008-10-20) 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(2333.3,2282.2,2458.2,2345.5,2065.2,2332.5,2077.5,1691.4,2381.9,2526,2212.1,2459.9,2178.8,2318.2,2661.8,2407.9,2040.6,2601.6,2106.3,1829.9,2546.1,2363,2435.8,2668,2316.9,2324.2,2610.8,2413.2,2345.2,2590.8,2132.1,1990.7,2641.7,2437.1,2649.2,2819.4,2405.6,2451.3,2878.5,2534.1,2670.6,2909.7,2261.8,2135.3,2870.4,2803.2,2775.1,2633.7,2930.6,2779.7,3039.2,2752.7,2743.1,2914,2711.9,2295.8,2840.6,3230.5,2761.1,2769.6),dim=c(1,60),dimnames=list(c('InvoerFrankrijk'),1:60)) > y <- array(NA,dim=c(1,60),dimnames=list(c('InvoerFrankrijk'),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 = 9498] |--[dendrogram w/ 2 branches and 29 members at h = 2140] | |--[dendrogram w/ 2 branches and 12 members at h = 364] | | |--[dendrogram w/ 2 branches and 3 members at h = 18.7] | | | |--leaf "21" | | | `--[dendrogram w/ 2 branches and 2 members at h = 8.1] | | | |--leaf "10" | | | `--leaf "40" | | `--[dendrogram w/ 2 branches and 9 members at h = 164] | | |--[dendrogram w/ 2 branches and 3 members at h = 17.5] | | | |--leaf "30" | | | `--[dendrogram w/ 2 branches and 2 members at h = 9.2] | | | |--leaf "18" | | | `--leaf "27" | | `--[dendrogram w/ 2 branches and 6 members at h = 59.6] | | |--[dendrogram w/ 2 branches and 3 members at h = 9.13] | | | |--leaf "15" | | | `--[dendrogram w/ 2 branches and 2 members at h = 2.6] | | | |--leaf "24" | | | `--leaf "41" | | `--[dendrogram w/ 2 branches and 3 members at h = 13.2] | | |--leaf "48" | | `--[dendrogram w/ 2 branches and 2 members at h = 7.5] | | |--leaf "33" | | `--leaf "35" | `--[dendrogram w/ 2 branches and 17 members at h = 937] | |--[dendrogram w/ 2 branches and 10 members at h = 189] | | |--[dendrogram w/ 2 branches and 3 members at h = 33.7] | | | |--leaf "57" | | | `--[dendrogram w/ 2 branches and 2 members at h = 16.2] | | | |--leaf "36" | | | `--leaf "46" | | `--[dendrogram w/ 2 branches and 7 members at h = 76.2] | | |--leaf "55" | | `--[dendrogram w/ 2 branches and 6 members at h = 48.8] | | |--[dendrogram w/ 2 branches and 3 members at h = 8.87] | | | |--leaf "60" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.6] | | | |--leaf "47" | | | `--leaf "50" | | `--[dendrogram w/ 2 branches and 3 members at h = 15.6] | | |--leaf "53" | | `--[dendrogram w/ 2 branches and 2 members at h = 8.4] | | |--leaf "52" | | `--leaf "59" | `--[dendrogram w/ 2 branches and 7 members at h = 497] | |--[dendrogram w/ 2 branches and 5 members at h = 88.8] | | |--[dendrogram w/ 2 branches and 2 members at h = 8.1] | | | |--leaf "39" | | | `--leaf "45" | | `--[dendrogram w/ 2 branches and 3 members at h = 23.6] | | |--leaf "49" | | `--[dendrogram w/ 2 branches and 2 members at h = 4.3] | | |--leaf "42" | | `--leaf "54" | `--[dendrogram w/ 2 branches and 2 members at h = 191] | |--leaf "51" | `--leaf "58" `--[dendrogram w/ 2 branches and 31 members at h = 3056] |--[dendrogram w/ 2 branches and 20 members at h = 740] | |--[dendrogram w/ 2 branches and 10 members at h = 157] | | |--[dendrogram w/ 2 branches and 3 members at h = 31.7] | | | |--leaf "43" | | | `--[dendrogram w/ 2 branches and 2 members at h = 13.6] | | | |--leaf "2" | | | `--leaf "56" | | `--[dendrogram w/ 2 branches and 7 members at h = 49.9] | | |--[dendrogram w/ 2 branches and 3 members at h = 8.43] | | | |--leaf "26" | | | `--[dendrogram w/ 2 branches and 2 members at h = 1.3] | | | |--leaf "14" | | | `--leaf "25" | | `--[dendrogram w/ 2 branches and 4 members at h = 24.3] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.3] | | | |--leaf "4" | | | `--leaf "29" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.8] | | |--leaf "1" | | `--leaf "6" | `--[dendrogram w/ 2 branches and 10 members at h = 192] | |--[dendrogram w/ 2 branches and 5 members at h = 42.7] | | |--[dendrogram w/ 2 branches and 2 members at h = 1.3] | | | |--leaf "23" | | | `--leaf "34" | | `--[dendrogram w/ 2 branches and 3 members at h = 9.77] | | |--leaf "38" | | `--[dendrogram w/ 2 branches and 2 members at h = 1.7] | | |--leaf "3" | | `--leaf "12" | `--[dendrogram w/ 2 branches and 5 members at h = 72.1] | |--[dendrogram w/ 2 branches and 3 members at h = 7.83] | | |--leaf "28" | | `--[dendrogram w/ 2 branches and 2 members at h = 2.3] | | |--leaf "16" | | `--leaf "37" | `--[dendrogram w/ 2 branches and 2 members at h = 18.9] | |--leaf "9" | `--leaf "22" `--[dendrogram w/ 2 branches and 11 members at h = 891] |--[dendrogram w/ 2 branches and 2 members at h = 138] | |--leaf "8" | `--leaf "20" `--[dendrogram w/ 2 branches and 9 members at h = 315] |--[dendrogram w/ 2 branches and 4 members at h = 93.3] | |--leaf "32" | `--[dendrogram w/ 2 branches and 3 members at h = 36.9] | |--leaf "17" | `--[dendrogram w/ 2 branches and 2 members at h = 12.3] | |--leaf "5" | `--leaf "7" `--[dendrogram w/ 2 branches and 5 members at h = 135] |--[dendrogram w/ 2 branches and 2 members at h = 33.3] | |--leaf "11" | `--leaf "13" `--[dendrogram w/ 2 branches and 3 members at h = 35.5] |--leaf "19" `--[dendrogram w/ 2 branches and 2 members at h = 3.2] |--leaf "31" `--leaf "44" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/1x1tr1226409657.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/freestat/rcomp/tmp/2keyv1226409657.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/3yovt1226409657.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/freestat/rcomp/tmp/4p7ud1226409657.tab") + } > > system("convert tmp/1x1tr1226409657.ps tmp/1x1tr1226409657.png") > system("convert tmp/2keyv1226409657.ps tmp/2keyv1226409657.png") convert: unable to open image `tmp/2keyv1226409657.ps': No such file or directory. convert: missing an image filename `tmp/2keyv1226409657.png'. > > > proc.time() user system elapsed 0.796 0.252 0.860