R version 2.7.2 (2008-08-25) 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(5.8 + ,4.7 + ,7.3 + ,5.8 + ,4.8 + ,7.2 + ,5.7 + ,4.7 + ,7.0 + ,5.5 + ,4.6 + ,6.7 + ,5.3 + ,4.5 + ,6.4 + ,5.2 + ,4.5 + ,6.1 + ,5.3 + ,4.8 + ,6.1 + ,5.3 + ,4.8 + ,5.9 + ,5.0 + ,4.6 + ,5.6 + ,4.8 + ,4.3 + ,5.5 + ,4.9 + ,4.3 + ,5.7 + ,5.3 + ,4.6 + ,6.1 + ,6.0 + ,5.4 + ,6.8 + ,6.2 + ,5.5 + ,7.1 + ,6.4 + ,5.5 + ,7.5 + ,6.4 + ,5.3 + ,7.8 + ,6.4 + ,5.2 + ,7.9 + ,6.2 + ,5.2 + ,7.6 + ,6.1 + ,5.4 + ,7.0 + ,6.0 + ,5.3 + ,6.9 + ,5.9 + ,5.0 + ,7.1 + ,6.2 + ,4.9 + ,7.9 + ,6.2 + ,4.9 + ,8.0 + ,6.4 + ,5.3 + ,7.9 + ,6.8 + ,6.3 + ,7.4 + ,6.9 + ,6.7 + ,7.2 + ,7.0 + ,6.7 + ,7.3 + ,7.0 + ,6.4 + ,7.7 + ,6.9 + ,6.1 + ,7.8 + ,6.7 + ,6.0 + ,7.6 + ,6.6 + ,6.2 + ,7.3 + ,6.5 + ,6.1 + ,7.0 + ,6.4 + ,6.0 + ,6.9 + ,6.5 + ,6.0 + ,7.2 + ,6.5 + ,5.9 + ,7.3 + ,6.6 + ,5.9 + ,7.5 + ,6.7 + ,6.0 + ,7.5 + ,6.8 + ,6.1 + ,7.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+ ,7.0 + ,6.3 + ,5.7 + ,6.9 + ,6.2 + ,5.7 + ,6.7 + ,6.0 + ,5.6 + ,6.4 + ,5.8 + ,5.4 + ,6.2 + ,5.5 + ,5.1 + ,5.9 + ,5.5 + ,5.1 + ,6.0 + ,5.7 + ,5.3 + ,6.3 + ,5.8 + ,5.3 + ,6.3 + ,5.7 + ,5.3 + ,6.1) + ,dim=c(3 + ,96) + ,dimnames=list(c('Total' + ,'Men>25' + ,'women>25') + ,1:96)) > y <- array(NA,dim=c(3,96),dimnames=list(c('Total','Men>25','women>25'),1:96)) > 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 96 members at h = 50.7] |--[dendrogram w/ 2 branches and 43 members at h = 10.8] | |--[dendrogram w/ 2 branches and 25 members at h = 2.37] | | |--[dendrogram w/ 2 branches and 16 members at h = 1.25] | | | |--[dendrogram w/ 2 branches and 8 members at h = 0.547] | | | | |--[dendrogram w/ 2 branches and 3 members at h = 0.176] | | | | | |--leaf "51" | | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | | | | |--leaf "28" | | | | | `--leaf "69" | | | | `--[dendrogram w/ 2 branches and 5 members at h = 0.279] | | | | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | | | | |--leaf "29" | | | | | `--leaf "62" | | | | `--[dendrogram w/ 2 branches and 3 members at h = 0.176] | | | | |--leaf "63" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | | | |--leaf "55" | | | | `--leaf "56" | | | `--[dendrogram w/ 2 branches and 8 members at h = 0.923] | | | |--[dendrogram w/ 2 branches and 4 members at h = 0.248] | | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | | | | |--leaf "70" | | | | | `--leaf "75" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | | | |--leaf "57" | | | | `--leaf "78" | | | `--[dendrogram w/ 2 branches and 4 members at h = 0.355] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | | | |--leaf "76" | | | | `--leaf "77" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.173] | | | |--leaf "49" | | | `--leaf "61" | | `--[dendrogram w/ 2 branches and 9 members at h = 1.77] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | | |--leaf "26" | | | `--leaf "27" | | `--[dendrogram w/ 2 branches and 7 members at h = 0.726] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.245] | | | |--leaf "25" | | | `--leaf "31" | | `--[dendrogram w/ 2 branches and 5 members at h = 0.288] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | | |--leaf "30" | | | `--leaf "37" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.128] | | |--leaf "50" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | |--leaf "38" | | `--leaf "79" | `--[dendrogram w/ 2 branches and 18 members at h = 3.39] | |--[dendrogram w/ 2 branches and 10 members at h = 1.17] | | |--[dendrogram w/ 2 branches and 4 members at h = 0.383] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | | | |--leaf "65" | | | | `--leaf "66" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.173] | | | |--leaf "67" | | | `--leaf "68" | | `--[dendrogram w/ 2 branches and 6 members at h = 0.438] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | | |--leaf "39" | | | `--leaf "52" | | `--[dendrogram w/ 2 branches and 4 members at h = 0.316] | | |--[dendrogram w/ 2 branches and 2 members at h = 0] | | | |--leaf "42" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | |--leaf "53" | | `--leaf "64" | `--[dendrogram w/ 2 branches and 8 members at h = 2.13] | |--[dendrogram w/ 2 branches and 4 members at h = 0.195] | | |--leaf "59" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.133] | | |--leaf "46" | | `--[dendrogram w/ 2 branches and 2 members at h = 0] | | |--leaf "58" | | `--leaf "60" | `--[dendrogram w/ 2 branches and 4 members at h = 0.854] | |--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | |--leaf "40" | | `--leaf "41" | `--[dendrogram w/ 2 branches and 2 members at h = 0.224] | |--leaf "47" | `--leaf "48" `--[dendrogram w/ 2 branches and 53 members at h = 19.6] |--[dendrogram w/ 2 branches and 16 members at h = 4.33] | |--[dendrogram w/ 2 branches and 7 members at h = 1.03] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | | |--leaf "92" | | | `--leaf "93" | | `--[dendrogram w/ 2 branches and 5 members at h = 0.327] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.173] | | | |--leaf "91" | | | `--leaf "96" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.176] | | |--leaf "84" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | |--leaf "94" | | `--leaf "95" | `--[dendrogram w/ 2 branches and 9 members at h = 2.15] | |--[dendrogram w/ 2 branches and 3 members at h = 0.396] | | |--leaf "9" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.224] | | |--leaf "10" | | `--leaf "11" | `--[dendrogram w/ 2 branches and 6 members at h = 0.986] | |--[dendrogram w/ 2 branches and 2 members at h = 0.374] | | |--leaf "4" | | `--leaf "5" | `--[dendrogram w/ 2 branches and 4 members at h = 0.416] | |--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | |--leaf "6" | | `--leaf "12" | `--[dendrogram w/ 2 branches and 2 members at h = 0.2] | |--leaf "7" | `--leaf "8" `--[dendrogram w/ 2 branches and 37 members at h = 6.68] |--[dendrogram w/ 2 branches and 14 members at h = 1.40] | |--[dendrogram w/ 2 branches and 7 members at h = 0.629] | | |--[dendrogram w/ 2 branches and 4 members at h = 0.219] | | | |--[dendrogram w/ 2 branches and 2 members at h = 0.1] | | | | |--leaf "14" | | | | `--leaf "87" | | | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | | |--leaf "19" | | | `--leaf "81" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.255] | | |--leaf "88" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.173] | | |--leaf "44" | | `--leaf "89" | `--[dendrogram w/ 2 branches and 7 members at h = 0.635] | |--[dendrogram w/ 2 branches and 4 members at h = 0.332] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | | |--leaf "13" | | | `--leaf "82" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.173] | | |--leaf "20" | | `--leaf "86" | `--[dendrogram w/ 2 branches and 3 members at h = 0.394] | |--leaf "90" | `--[dendrogram w/ 2 branches and 2 members at h = 0.224] | |--leaf "83" | `--leaf "85" `--[dendrogram w/ 2 branches and 23 members at h = 6] |--[dendrogram w/ 2 branches and 13 members at h = 2.13] | |--[dendrogram w/ 2 branches and 6 members at h = 0.55] | | |--[dendrogram w/ 2 branches and 2 members at h = 0.173] | | | |--leaf "32" | | | `--leaf "33" | | `--[dendrogram w/ 2 branches and 4 members at h = 0.363] | | |--leaf "45" | | `--[dendrogram w/ 2 branches and 3 members at h = 0.217] | | |--leaf "43" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | |--leaf "34" | | `--leaf "35" | `--[dendrogram w/ 2 branches and 7 members at h = 0.78] | |--[dendrogram w/ 2 branches and 3 members at h = 0.217] | | |--leaf "80" | | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | | |--leaf "36" | | `--leaf "74" | `--[dendrogram w/ 2 branches and 4 members at h = 0.264] | |--leaf "15" | `--[dendrogram w/ 2 branches and 3 members at h = 0.128] | |--leaf "73" | `--[dendrogram w/ 2 branches and 2 members at h = 0.1] | |--leaf "71" | `--leaf "72" `--[dendrogram w/ 2 branches and 10 members at h = 3.41] |--[dendrogram w/ 2 branches and 4 members at h = 0.380] | |--leaf "21" | `--[dendrogram w/ 2 branches and 3 members at h = 0.327] | |--leaf "3" | `--[dendrogram w/ 2 branches and 2 members at h = 0.141] | |--leaf "1" | `--leaf "2" `--[dendrogram w/ 2 branches and 6 members at h = 0.875] |--[dendrogram w/ 2 branches and 2 members at h = 0.1] | |--leaf "22" | `--leaf "23" `--[dendrogram w/ 2 branches and 4 members at h = 0.46] |--leaf "18" `--[dendrogram w/ 2 branches and 3 members at h = 0.128] |--leaf "16" `--[dendrogram w/ 2 branches and 2 members at h = 0.1] |--leaf "17" `--leaf "24" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1jb5y1226486715.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/23oft1226486715.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/3hmxd1226486715.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/4pdzu1226486715.tab") + } > > system("convert tmp/1jb5y1226486715.ps tmp/1jb5y1226486715.png") > system("convert tmp/23oft1226486715.ps tmp/23oft1226486715.png") convert: unable to open image `tmp/23oft1226486715.ps': No such file or directory. convert: missing an image filename `tmp/23oft1226486715.png'. > > > proc.time() user system elapsed 1.012 0.224 1.350