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(3822.5,538.9,2828.3,4000.9,1609.3,4092.2,556.4,3083.6,4053.7,1577.5,3628.9,498,2855.1,3774,1493,4391.4,541,3058.3,4171.2,1741,4057.6,512.1,2871.7,3787.8,1709.3,4051.9,480.4,2849.7,3677.8,1698.8,3971.8,457.6,2833.2,3747.8,1756.5,3310.5,457.3,2341.3,2684.9,1280.5,3814.8,461.4,2713.5,3341.1,1576.5,3977.1,455.3,2959,3611.6,1682.1,3451.4,384,2489.2,3317.1,1536.7,2678.6,329.3,2378.3,3123.4,1478.6,3279.3,396.3,2404.6,3079.8,1487.6),dim=c(5,13),dimnames=list(c('Frankrijk','Luxemburg','Nederland','Duitsland','Verenigd.Koninkrijk'),1:13)) > y <- array(NA,dim=c(5,13),dimnames=list(c('Frankrijk','Luxemburg','Nederland','Duitsland','Verenigd.Koninkrijk'),1:13)) > 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 13 members at h = 4421] |--[dendrogram w/ 2 branches and 5 members at h = 1039] | |--[dendrogram w/ 2 branches and 3 members at h = 641] | | |--leaf "9" | | `--[dendrogram w/ 2 branches and 2 members at h = 309] | | |--leaf "11" | | `--leaf "13" | `--[dendrogram w/ 2 branches and 2 members at h = 805] | |--leaf "8" | `--leaf "12" `--[dendrogram w/ 2 branches and 8 members at h = 1059] |--[dendrogram w/ 2 branches and 2 members at h = 362] | |--leaf "2" | `--leaf "4" `--[dendrogram w/ 2 branches and 6 members at h = 754] |--[dendrogram w/ 2 branches and 4 members at h = 225] | |--leaf "10" | `--[dendrogram w/ 2 branches and 3 members at h = 127] | |--leaf "7" | `--[dendrogram w/ 2 branches and 2 members at h = 117] | |--leaf "5" | `--leaf "6" `--[dendrogram w/ 2 branches and 2 members at h = 324] |--leaf "1" `--leaf "3" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/14x6w1226506229.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/20zk31226506229.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/3rpor1226506230.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/42qcu1226506230.tab") + } > > system("convert tmp/14x6w1226506229.ps tmp/14x6w1226506229.png") > system("convert tmp/20zk31226506229.ps tmp/20zk31226506229.png") convert: unable to open image `tmp/20zk31226506229.ps': No such file or directory. convert: missing an image filename `tmp/20zk31226506229.png'. > > > proc.time() user system elapsed 1.203 0.252 1.270