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(1332.7 + ,744.8 + ,64.5 + ,53.3 + ,1343.8 + ,672.1 + ,57.9 + ,66.9 + ,1421.6 + ,666.6 + ,72.5 + ,73.7 + ,1329.8 + ,760.8 + ,82.9 + ,71.9 + ,1306.8 + ,756 + ,62.7 + ,67.9 + ,1412.8 + ,604.4 + ,66.6 + ,77.5 + ,1358.1 + ,883.9 + ,70.9 + ,82 + ,1163.9 + ,527.9 + ,56.3 + ,40.5 + ,1467.9 + ,756.2 + ,81.2 + ,76.2 + ,1433.7 + ,812.9 + ,67.8 + ,75 + ,1362.2 + ,655.6 + ,57.2 + ,64 + ,1299 + ,707.6 + ,62.8 + ,77.2 + ,1291.5 + ,612.6 + ,51.2 + ,63.9 + ,1452.7 + ,659.2 + ,66.5 + ,71.4 + ,1555.4 + ,833.4 + ,71.5 + ,71.3 + ,1402.5 + ,727.8 + ,67.8 + ,50 + ,1242.9 + ,797.2 + ,56.9 + ,47.9 + ,1514.6 + ,753 + ,90.6 + ,55.2 + ,1308.6 + ,762 + ,64.1 + ,61.8 + ,1239.3 + ,613.7 + ,65.7 + ,53.6 + ,1519.9 + ,759.2 + ,77.9 + ,60 + ,1659.4 + ,816.4 + ,84.2 + ,72.7 + ,1597.6 + ,736.8 + ,81.7 + ,63.6 + ,1340.6 + ,680.1 + ,65.9 + ,62.1 + ,1427.2 + ,736.5 + ,76.1 + ,58.1 + ,1438.1 + ,637.2 + ,80.1 + ,68.1 + ,1616.2 + ,801.9 + ,74.3 + ,65.5 + ,1392.8 + ,772.3 + ,86.5 + ,59.3 + ,1318.7 + ,897.3 + ,70.9 + ,65.7 + ,1420.9 + ,792.1 + ,91.5 + ,68.3 + ,1221 + ,826.8 + ,93.7 + ,77.8 + ,1310 + ,666.8 + ,77.5 + ,49.1 + ,1466.7 + ,906.6 + ,100.3 + ,96.9 + ,1299.3 + ,871.4 + ,85.7 + ,64.6 + ,1640 + ,891 + ,95 + ,67 + ,1506.3 + ,739.2 + ,73.7 + ,64.6 + ,1530.2 + ,833.6 + ,87.6 + ,84.3 + ,1661.9 + ,715.6 + ,87.6 + ,72.6 + ,1880.3 + ,871.6 + ,92.9 + ,71.3 + ,1230.8 + ,751.6 + ,80.7 + ,52.8 + ,1406.5 + ,1005.5 + ,74 + ,63.9 + ,1523.5 + ,681.2 + ,87.7 + ,67.9 + ,1323.2 + ,837.3 + ,68.2 + ,74.1 + ,1319.2 + ,674.7 + ,117.4 + ,61.7 + ,1500.7 + ,806.3 + ,100.1 + ,74.1 + ,1483 + ,860.2 + ,97.7 + ,83.5 + ,1497 + ,689.8 + ,101.1 + ,75.6 + ,1219.8 + ,691.6 + ,87.6 + ,77.9 + ,1472.9 + ,682.6 + ,83.2 + ,69.2 + ,1423.9 + ,800.1 + ,85.9 + ,67.8 + ,1629.6 + ,1023.7 + ,118 + ,74.8 + ,1353.4 + ,733.5 + ,87.3 + ,69.7 + ,1366.8 + ,875.3 + ,79.5 + ,69.9 + ,1527.1 + ,770.2 + ,93.2 + ,84.3 + ,1487.6 + ,1005.7 + ,99.2 + ,81.7 + ,1478.6 + ,982.3 + ,66.6 + ,69.3 + ,1536.7 + ,742.9 + ,83.9 + ,83.8 + ,1682.1 + ,974.2 + ,100.4 + ,96 + ,1576.5 + ,822.3 + ,73.5 + ,74.2 + ,1280.5 + ,773.2 + ,60.8 + ,70.4) + ,dim=c(4 + ,60) + ,dimnames=list(c('Verenigd_Koninkrijk' + ,'Verenigde_Staten_van_Amerika' + ,'Canada' + ,'Australie') + ,1:60)) > y <- array(NA,dim=c(4,60),dimnames=list(c('Verenigd_Koninkrijk','Verenigde_Staten_van_Amerika','Canada','Australie'),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 = 3381] |--[dendrogram w/ 2 branches and 23 members at h = 967] | |--[dendrogram w/ 2 branches and 17 members at h = 467] | | |--[dendrogram w/ 2 branches and 5 members at h = 183] | | | |--[dendrogram w/ 2 branches and 2 members at h = 68.6] | | | | |--leaf "23" | | | | `--leaf "38" | | | `--[dendrogram w/ 2 branches and 3 members at h = 99.3] | | | |--leaf "35" | | | `--[dendrogram w/ 2 branches and 2 members at h = 47.2] | | | |--leaf "22" | | | `--leaf "27" | | `--[dendrogram w/ 2 branches and 12 members at h = 334] | | |--[dendrogram w/ 2 branches and 6 members at h = 73.3] | | | |--leaf "9" | | | `--[dendrogram w/ 2 branches and 5 members at h = 53.7] | | | |--[dendrogram w/ 2 branches and 3 members at h = 28.1] | | | | |--leaf "36" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 15.8] | | | | |--leaf "18" | | | | `--leaf "21" | | | `--[dendrogram w/ 2 branches and 2 members at h = 30.4] | | | |--leaf "54" | | | `--leaf "57" | | `--[dendrogram w/ 2 branches and 6 members at h = 173] | | |--[dendrogram w/ 2 branches and 2 members at h = 51] | | | |--leaf "33" | | | `--leaf "46" | | `--[dendrogram w/ 2 branches and 4 members at h = 82.6] | | |--[dendrogram w/ 2 branches and 2 members at h = 24.1] | | | |--leaf "15" | | | `--leaf "59" | | `--[dendrogram w/ 2 branches and 2 members at h = 43.3] | | |--leaf "37" | | `--leaf "45" | `--[dendrogram w/ 2 branches and 6 members at h = 582] | |--[dendrogram w/ 2 branches and 3 members at h = 94.4] | | |--leaf "41" | | `--[dendrogram w/ 2 branches and 2 members at h = 43.0] | | |--leaf "55" | | `--leaf "56" | `--[dendrogram w/ 2 branches and 3 members at h = 320] | |--leaf "39" | `--[dendrogram w/ 2 branches and 2 members at h = 77.2] | |--leaf "51" | `--leaf "58" `--[dendrogram w/ 2 branches and 37 members at h = 1202] |--[dendrogram w/ 2 branches and 13 members at h = 526] | |--[dendrogram w/ 2 branches and 6 members at h = 130] | | |--[dendrogram w/ 2 branches and 3 members at h = 36.6] | | | |--leaf "10" | | | `--[dendrogram w/ 2 branches and 2 members at h = 10.2] | | | |--leaf "30" | | | `--leaf "50" | | `--[dendrogram w/ 2 branches and 3 members at h = 57.7] | | |--leaf "28" | | `--[dendrogram w/ 2 branches and 2 members at h = 28.6] | | |--leaf "16" | | `--leaf "25" | `--[dendrogram w/ 2 branches and 7 members at h = 189] | |--[dendrogram w/ 2 branches and 3 members at h = 44.6] | | |--leaf "42" | | `--[dendrogram w/ 2 branches and 2 members at h = 31.5] | | |--leaf "47" | | `--leaf "49" | `--[dendrogram w/ 2 branches and 4 members at h = 71.7] | |--leaf "6" | `--[dendrogram w/ 2 branches and 3 members at h = 35.1] | |--leaf "3" | `--[dendrogram w/ 2 branches and 2 members at h = 29.9] | |--leaf "14" | `--leaf "26" `--[dendrogram w/ 2 branches and 24 members at h = 945] |--[dendrogram w/ 2 branches and 10 members at h = 335] | |--[dendrogram w/ 2 branches and 6 members at h = 98] | | |--[dendrogram w/ 2 branches and 3 members at h = 34.9] | | | |--leaf "11" | | | `--[dendrogram w/ 2 branches and 2 members at h = 12.7] | | | |--leaf "2" | | | `--leaf "24" | | `--[dendrogram w/ 2 branches and 3 members at h = 66.5] | | |--leaf "12" | | `--[dendrogram w/ 2 branches and 2 members at h = 43.6] | | |--leaf "32" | | `--leaf "44" | `--[dendrogram w/ 2 branches and 4 members at h = 182] | |--leaf "8" | `--[dendrogram w/ 2 branches and 3 members at h = 115] | |--leaf "48" | `--[dendrogram w/ 2 branches and 2 members at h = 55.2] | |--leaf "13" | `--leaf "20" `--[dendrogram w/ 2 branches and 14 members at h = 487] |--[dendrogram w/ 2 branches and 5 members at h = 90] | |--[dendrogram w/ 2 branches and 2 members at h = 19.2] | | |--leaf "7" | | `--leaf "53" | `--[dendrogram w/ 2 branches and 3 members at h = 59.4] | |--leaf "43" | `--[dendrogram w/ 2 branches and 2 members at h = 35.6] | |--leaf "29" | `--leaf "34" `--[dendrogram w/ 2 branches and 9 members at h = 255] |--[dendrogram w/ 2 branches and 3 members at h = 76.3] | |--leaf "31" | `--[dendrogram w/ 2 branches and 2 members at h = 53.1] | |--leaf "17" | `--leaf "40" `--[dendrogram w/ 2 branches and 6 members at h = 89.5] |--[dendrogram w/ 2 branches and 3 members at h = 38.5] | |--leaf "52" | `--[dendrogram w/ 2 branches and 2 members at h = 30.8] | |--leaf "1" | `--leaf "4" `--[dendrogram w/ 2 branches and 3 members at h = 39.2] |--leaf "60" `--[dendrogram w/ 2 branches and 2 members at h = 8.85] |--leaf "5" `--leaf "19" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/freestat/rcomp/tmp/1uljj1226268916.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/2vkjz1226268916.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/3c6ar1226268916.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/47j8b1226268916.tab") + } > > system("convert tmp/1uljj1226268916.ps tmp/1uljj1226268916.png") > system("convert tmp/2vkjz1226268916.ps tmp/2vkjz1226268916.png") convert: unable to open image `tmp/2vkjz1226268916.ps': No such file or directory. convert: missing an image filename `tmp/2vkjz1226268916.png'. > > > proc.time() user system elapsed 1.113 0.270 1.197