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(299.63 + ,154.783 + ,301.606 + ,305.945 + ,187.646 + ,268.225 + ,382.252 + ,237.863 + ,362.082 + ,348.846 + ,215.54 + ,310.984 + ,335.367 + ,231.745 + ,350.907 + ,373.617 + ,199.548 + ,365.759 + ,312.612 + ,164.147 + ,357.504 + ,312.232 + ,159.388 + ,432.236 + ,337.161 + ,203.514 + ,394.335 + ,331.476 + ,224.901 + ,404.182 + ,350.103 + ,211.539 + ,371.721 + ,345.127 + ,211.16 + ,387.012 + ,297.256 + ,181.712 + ,280.042 + ,295.979 + ,203.908 + ,357.111 + ,361.007 + ,240.774 + ,359.451 + ,321.803 + ,232.819 + ,341.206 + ,354.937 + ,255.221 + ,349.156 + ,349.432 + ,246.7 + ,430.298 + ,290.979 + ,206.263 + ,354.447 + ,349.576 + ,211.679 + ,400.785 + ,327.625 + ,236.601 + ,358.974 + ,349.377 + ,237.43 + ,352.853 + ,336.777 + ,233.767 + ,374.229 + ,339.134 + ,219.52 + ,364.568 + ,323.321 + ,222.625 + ,352.411 + ,318.86 + ,216.238 + ,376.47 + ,373.583 + ,248.587 + ,357.475 + ,333.03 + ,221.376 + ,299.497 + ,408.556 + ,242.453 + ,361.805 + ,414.646 + ,246.539 + ,343.188 + ,291.514 + ,189.351 + ,335.597 + ,348.857 + ,185.956 + ,330.985 + ,349.368 + ,213.175 + ,336.723 + ,375.765 + ,228.732 + ,348.076 + ,364.136 + ,212.93 + ,317.518 + ,349.53 + ,218.254 + ,345.737 + ,348.167 + ,227.103 + ,342.568 + ,332.856 + ,219.026 + ,352.951 + ,360.551 + ,264.529 + ,400.269 + ,346.969 + ,262.057 + ,428.121 + ,392.815 + ,258.779 + ,475.804 + ,372.02 + ,231.928 + ,392.732 + ,371.027 + ,211.167 + ,388.22 + ,342.672 + ,205.439 + ,410.643 + ,367.343 + ,224.883 + ,428.044 + ,390.786 + ,228.624 + ,530.799 + ,343.785 + ,209.435 + ,463.074 + ,362.6 + ,215.607 + ,477.686 + ,349.468 + ,287.356 + ,440.586 + ,340.624 + ,306.015 + ,424.757 + ,369.536 + ,338.546 + ,511.061 + ,407.782 + ,344.16 + ,511.421 + ,392.239 + ,328.412 + ,454.39 + ,404.824 + ,342.006 + ,498.403 + ,373.669 + ,277.668 + ,516.143 + ,344.902 + ,290.477 + ,463.642 + ,396.7 + ,314.967 + ,498.391 + ,398.911 + ,324.627 + ,533.752 + ,366.009 + ,290.646 + ,404.341 + ,392.484 + ,315.033 + ,435.645) + ,dim=c(3 + ,60) + ,dimnames=list(c('dieren' + ,'planten' + ,'mineralen') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('dieren','planten','mineralen'),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 = 1946] |--[dendrogram w/ 2 branches and 21 members at h = 469] | |--[dendrogram w/ 2 branches and 5 members at h = 45] | | |--[dendrogram w/ 2 branches and 2 members at h = 13.5] | | | |--leaf "52" | | | `--leaf "54" | | `--[dendrogram w/ 2 branches and 3 members at h = 39.6] | | |--leaf "51" | | `--[dendrogram w/ 2 branches and 2 members at h = 36.7] | | |--leaf "57" | | `--leaf "58" | `--[dendrogram w/ 2 branches and 16 members at h = 303] | |--[dendrogram w/ 2 branches and 10 members at h = 152] | | |--[dendrogram w/ 2 branches and 5 members at h = 73.6] | | | |--[dendrogram w/ 2 branches and 2 members at h = 27] | | | | |--leaf "39" | | | | `--leaf "59" | | | `--[dendrogram w/ 2 branches and 3 members at h = 41.9] | | | |--leaf "45" | | | `--[dendrogram w/ 2 branches and 2 members at h = 15.7] | | | |--leaf "18" | | | `--leaf "40" | | `--[dendrogram w/ 2 branches and 5 members at h = 102] | | |--[dendrogram w/ 2 branches and 2 members at h = 23.0] | | | |--leaf "53" | | | `--leaf "60" | | `--[dendrogram w/ 2 branches and 3 members at h = 37.5] | | |--leaf "50" | | `--[dendrogram w/ 2 branches and 2 members at h = 23.7] | | |--leaf "49" | | `--leaf "56" | `--[dendrogram w/ 2 branches and 6 members at h = 176] | |--[dendrogram w/ 2 branches and 3 members at h = 61.7] | | |--leaf "46" | | `--[dendrogram w/ 2 branches and 2 members at h = 48.5] | | |--leaf "41" | | `--leaf "55" | `--[dendrogram w/ 2 branches and 3 members at h = 95] | |--leaf "8" | `--[dendrogram w/ 2 branches and 2 members at h = 24.6] | |--leaf "47" | `--leaf "48" `--[dendrogram w/ 2 branches and 39 members at h = 476] |--[dendrogram w/ 2 branches and 7 members at h = 178] | |--[dendrogram w/ 2 branches and 3 members at h = 49.3] | | |--leaf "1" | | `--[dendrogram w/ 2 branches and 2 members at h = 15.8] | | |--leaf "2" | | `--leaf "13" | `--[dendrogram w/ 2 branches and 4 members at h = 55.4] | |--leaf "7" | `--[dendrogram w/ 2 branches and 3 members at h = 32.4] | |--leaf "31" | `--[dendrogram w/ 2 branches and 2 members at h = 6.14] | |--leaf "14" | `--leaf "19" `--[dendrogram w/ 2 branches and 32 members at h = 288] |--[dendrogram w/ 2 branches and 8 members at h = 86] | |--[dendrogram w/ 2 branches and 5 members at h = 28.5] | | |--leaf "10" | | `--[dendrogram w/ 2 branches and 4 members at h = 22.8] | | |--[dendrogram w/ 2 branches and 2 members at h = 13.2] | | | |--leaf "9" | | | `--leaf "12" | | `--[dendrogram w/ 2 branches and 2 members at h = 13.6] | | |--leaf "20" | | `--leaf "44" | `--[dendrogram w/ 2 branches and 3 members at h = 38] | |--leaf "6" | `--[dendrogram w/ 2 branches and 2 members at h = 21.3] | |--leaf "42" | `--leaf "43" `--[dendrogram w/ 2 branches and 24 members at h = 242] |--[dendrogram w/ 2 branches and 8 members at h = 99.7] | |--[dendrogram w/ 2 branches and 2 members at h = 20] | | |--leaf "29" | | `--leaf "30" | `--[dendrogram w/ 2 branches and 6 members at h = 44] | |--[dendrogram w/ 2 branches and 3 members at h = 20.6] | | |--leaf "17" | | `--[dendrogram w/ 2 branches and 2 members at h = 13.8] | | |--leaf "15" | | `--leaf "22" | `--[dendrogram w/ 2 branches and 3 members at h = 21.8] | |--leaf "34" | `--[dendrogram w/ 2 branches and 2 members at h = 14.5] | |--leaf "3" | `--leaf "27" `--[dendrogram w/ 2 branches and 16 members at h = 171] |--[dendrogram w/ 2 branches and 9 members at h = 59.4] | |--[dendrogram w/ 2 branches and 5 members at h = 21.1] | | |--[dendrogram w/ 2 branches and 2 members at h = 10.2] | | | |--leaf "25" | | | `--leaf "38" | | `--[dendrogram w/ 2 branches and 3 members at h = 19.8] | | |--leaf "16" | | `--[dendrogram w/ 2 branches and 2 members at h = 12.2] | | |--leaf "5" | | `--leaf "21" | `--[dendrogram w/ 2 branches and 4 members at h = 30.6] | |--leaf "26" | `--[dendrogram w/ 2 branches and 3 members at h = 23.8] | |--leaf "23" | `--[dendrogram w/ 2 branches and 2 members at h = 15.3] | |--leaf "11" | `--leaf "24" `--[dendrogram w/ 2 branches and 7 members at h = 67.2] |--[dendrogram w/ 2 branches and 3 members at h = 32.6] | |--leaf "28" | `--[dendrogram w/ 2 branches and 2 members at h = 16.8] | |--leaf "4" | `--leaf "35" `--[dendrogram w/ 2 branches and 4 members at h = 47.2] |--leaf "32" `--[dendrogram w/ 2 branches and 3 members at h = 13.8] |--leaf "33" `--[dendrogram w/ 2 branches and 2 members at h = 9.5] |--leaf "36" `--leaf "37" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/12x0n1226254643.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/2g7gb1226254643.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/36kfr1226254643.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/4pyw11226254643.tab") + } > > system("convert tmp/12x0n1226254643.ps tmp/12x0n1226254643.png") > system("convert tmp/2g7gb1226254643.ps tmp/2g7gb1226254643.png") convert: unable to open image `tmp/2g7gb1226254643.ps': No such file or directory. convert: missing an image filename `tmp/2g7gb1226254643.png'. > > > proc.time() user system elapsed 1.115 0.268 1.273