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(8.1,7.7,8.5,8.2,7.8,8.6,8,7.7,8.5,8.1,7.7,8.5,8.3,7.7,9,8.2,7.7,9,8.1,7.6,8.8,7.7,7.5,8,7.6,7.4,7.9,7.7,7.4,8.1,8.2,7.5,9.3,8.4,7.6,9.4,8.4,7.6,9.4,8.6,8.1,9.3,8.4,7.8,9,8.5,8,9.1,8.7,7.9,9.7,8.7,7.9,9.7,8.6,7.8,9.6,7.4,6.7,8.3,7.3,6.6,8.2,7.4,6.6,8.4,9,7.7,10.6,9.2,7.9,10.9,9.2,8,10.9,8.5,7.7,9.6,8.3,7.5,9.3,8.3,7.6,9.3,8.6,7.8,9.6,8.6,7.8,9.5,8.5,7.7,9.5,8.1,7.4,9,8.1,7.5,8.9,8,7.2,9,8.6,7.5,10.1,8.7,7.6,10.2,8.7,7.6,10.2,8.6,7.8,9.5,8.4,7.7,9.3,8.4,7.7,9.3,8.7,8.2,9.4,8.7,8.2,9.3,8.5,8.1,9.1,8.3,7.8,9,8.3,7.8,8.9,8.3,7.7,9,8.1,6.7,9.8,8.2,6.7,10,8.1,6.7,9.8,8.1,7.2,9.4,7.9,6.9,9,7.7,6.8,8.9,8.1,7.2,9.3,8,7.1,9.1,7.7,6.9,8.8,7.8,6.9,8.9,7.6,6.7,8.7,7.4,6.5,8.6,7.7,6.6,9.1,7.9,6.6,9.3,7.6,6.5,8.9),dim=c(3,61),dimnames=list(c('man','vrouw','totaal'),1:61)) > y <- array(NA,dim=c(3,61),dimnames=list(c('man','vrouw','totaal'),1:61)) > 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 = 'complete' > 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 61 members at h = 3.59] |--[dendrogram w/ 2 branches and 6 members at h = 1.12] | |--[dendrogram w/ 2 branches and 3 members at h = 0.173] | | |--leaf "35" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "36" | | `--leaf "37" | `--[dendrogram w/ 2 branches and 3 members at h = 0.469] | |--leaf "23" | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | |--leaf "24" | `--leaf "25" `--[dendrogram w/ 2 branches and 55 members at h = 2.44] |--[dendrogram w/ 2 branches and 8 members at h = 1.20] | |--[dendrogram w/ 2 branches and 3 members at h = 0.224] | | |--leaf "9" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | |--leaf "8" | | `--leaf "10" | `--[dendrogram w/ 2 branches and 5 members at h = 0.592] | |--[dendrogram w/ 2 branches and 3 members at h = 0.224] | | |--leaf "21" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | |--leaf "20" | | `--leaf "22" | `--[dendrogram w/ 2 branches and 2 members at h = 0.3] | |--leaf "57" | `--leaf "58" `--[dendrogram w/ 2 branches and 47 members at h = 2.09] |--[dendrogram w/ 2 branches and 10 members at h = 1.32] | |--[dendrogram w/ 2 branches and 3 members at h = 0.224] | | |--leaf "48" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "47" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 7 members at h = 0.616] | |--[dendrogram w/ 2 branches and 4 members at h = 0.283] | | |--leaf "51" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.141] | | |--leaf "52" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | |--leaf "55" | | `--leaf "56" | `--[dendrogram w/ 2 branches and 3 members at h = 0.51] | |--leaf "60" | `--[dendrogram w/ 2 branches and 2 members at h = 0.245] | |--leaf "59" | `--leaf "61" `--[dendrogram w/ 2 branches and 37 members at h = 1.40] |--[dendrogram w/ 2 branches and 13 members at h = 0.663] | |--[dendrogram w/ 2 branches and 8 members at h = 0.346] | | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | | |--leaf "17" | | | `--leaf "18" | | `--[dendrogram w/ 2 branches and 6 members at h = 0.173] | | |--[dendrogram w/ 2 branches and 4 members at h = 0.1] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | | | |--leaf "19" | | | | `--leaf "29" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | | |--leaf "30" | | | `--leaf "38" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | |--leaf "26" | | `--leaf "31" | `--[dendrogram w/ 2 branches and 5 members at h = 0.412] | |--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | |--leaf "16" | | `--leaf "43" | `--[dendrogram w/ 2 branches and 3 members at h = 0.173] | |--leaf "14" | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | |--leaf "41" | `--leaf "42" `--[dendrogram w/ 2 branches and 24 members at h = 1.03] |--[dendrogram w/ 2 branches and 13 members at h = 0.648] | |--[dendrogram w/ 2 branches and 4 members at h = 0.245] | | |--leaf "2" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.1] | | |--leaf "3" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "1" | | `--leaf "4" | `--[dendrogram w/ 2 branches and 9 members at h = 0.5] | |--[dendrogram w/ 2 branches and 6 members at h = 0.224] | | |--leaf "6" | | `--[dendrogram w/ 2 branches and 5 members at h = 0.141] | | |--leaf "45" | | `--[dendrogram w/ 2 branches and 4 members at h = 0.141] | | |--leaf "15" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.1] | | |--leaf "44" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "5" | | `--leaf "46" | `--[dendrogram w/ 2 branches and 3 members at h = 0.283] | |--leaf "32" | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | |--leaf "7" | `--leaf "33" `--[dendrogram w/ 2 branches and 11 members at h = 0.748] |--[dendrogram w/ 2 branches and 7 members at h = 0.283] | |--[dendrogram w/ 2 branches and 4 members at h = 0.141] | | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | | |--leaf "12" | | | `--leaf "13" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "39" | | `--leaf "40" | `--[dendrogram w/ 2 branches and 3 members at h = 0.141] | |--leaf "11" | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | |--leaf "27" | `--leaf "28" `--[dendrogram w/ 2 branches and 4 members at h = 0.412] |--[dendrogram w/ 2 branches and 2 members at h = 0.1] | |--leaf "50" | `--leaf "53" `--[dendrogram w/ 2 branches and 2 members at h = 0.141] |--leaf "34" `--leaf "54" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1yj3h1194171497.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/2fgp21194171497.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/3ovl61194171498.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/4yt8u1194171498.tab") + } > > system("convert tmp/1yj3h1194171497.ps tmp/1yj3h1194171497.png") > system("convert tmp/2fgp21194171497.ps tmp/2fgp21194171497.png") convert: unable to open image `tmp/2fgp21194171497.ps': No such file or directory. convert: missing an image filename `tmp/2fgp21194171497.png'. > > > proc.time() user system elapsed 1.552 0.293 1.619