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(1045.9 + ,1593 + ,0.8721 + ,4.5 + ,1401.9 + ,1477.9 + ,0.8552 + ,4.7 + ,1027.6 + ,1733.7 + ,0.8564 + ,4.75 + ,1703.8 + ,1569.7 + ,0.8973 + ,4.75 + ,1481.3 + ,1843.7 + ,0.9383 + ,4.75 + ,1422.7 + ,1950.3 + ,0.9217 + ,4.75 + ,1304.7 + ,1657.5 + ,0.9095 + ,4.75 + ,1246.1 + ,1772.1 + ,0.892 + ,4.75 + ,1417.8 + ,1568.3 + ,0.8742 + ,4.58 + ,1459.1 + ,1809.8 + ,0.8532 + ,4.5 + ,1156.4 + ,1646.7 + ,0.8607 + ,4.5 + ,1304.5 + ,1808.5 + ,0.9005 + ,4.49 + ,1336.9 + ,1763.9 + ,0.9111 + ,4.03 + ,1372.3 + ,1625.5 + ,0.9059 + ,3.75 + ,975.5 + ,1538.8 + ,0.8883 + ,3.39 + ,1180.8 + ,1342.4 + ,0.8924 + ,3.25 + ,1361.3 + ,1645.1 + ,0.8833 + ,3.25 + ,1428.1 + ,1619.9 + ,0.87 + ,3.25 + ,1355.9 + ,1338.1 + ,0.8758 + ,3.25 + ,1781.2 + ,1505.5 + ,0.8858 + ,3.25 + ,1697 + ,1529.1 + ,0.917 + ,3.25 + ,1852 + ,1511.9 + ,0.9554 + ,3.25 + ,1844.1 + ,1656.7 + ,0.9922 + ,3.25 + ,1967.2 + ,1694.4 + ,0.9778 + ,3.25 + ,1747.1 + ,1662.3 + ,0.9808 + ,3.25 + ,1863.9 + ,1588.7 + ,0.9811 + ,3.25 + ,1559.3 + ,1483.3 + ,1.0014 + ,3.25 + ,1675 + ,1585.6 + ,1.0183 + ,2.85 + ,2237.5 + ,1658.9 + ,1.0622 + ,2.75 + ,1965.2 + ,1584.4 + ,1.0773 + ,2.75 + ,1871.5 + ,1470.6 + ,1.0807 + ,2.55 + ,1752.2 + ,1618.7 + ,1.0848 + ,2.5 + ,1360.7 + ,1407.6 + ,1.1582 + ,2.5 + ,1444.3 + ,1473.9 + ,1.1663 + ,2.1 + ,1621.6 + ,1515.3 + ,1.1372 + ,2 + ,1368 + ,1485.4 + ,1.1139 + ,2 + ,1553.9 + ,1496.1 + ,1.1222 + ,2 + ,1695.3 + ,1493.5 + ,1.1692 + ,2 + ,1397.1 + ,1298.4 + ,1.1702 + ,2 + ,1848.4 + ,1375.3 + ,1.2286 + ,2 + ,1809.2 + ,1507.9 + ,1.2613 + ,2 + ,1551.1 + ,1455.3 + ,1.2646 + ,2 + ,1546.6 + ,1363.3 + ,1.2262 + ,2 + ,1467.9 + ,1392.8 + ,1.1985 + ,2 + ,1662.4 + ,1348.8 + ,1.2007 + ,2 + ,1972.3 + ,1880.3 + ,1.2138 + ,2 + ,1673.5 + ,1669.2 + ,1.2266 + ,2 + ,1762 + ,1543.6 + ,1.2176 + ,2 + ,2019.8 + ,1701.2 + ,1.2218 + ,2 + ,1754.3 + ,1516.5 + ,1.249 + ,2 + ,1400.4 + ,1466.8 + ,1.2991 + ,2 + ,1453.6 + ,1484.1 + ,1.3408 + ,2 + ,1740.9 + ,1577.2 + ,1.3119 + ,2 + ,1694.6 + ,1684.5 + ,1.3014 + ,2 + ,1541.2 + ,1414.7 + ,1.3201 + ,2 + ,1482.3 + ,1674.5 + ,1.2938 + ,2 + ,1632.1 + ,1598.7 + ,1.2694 + ,2 + ,1837.3 + ,1739.1 + ,1.2165 + ,2 + ,1797 + ,1674.6 + ,1.2037 + ,2 + ,2066.2 + ,1671.8 + ,1.2292 + ,2 + ,1983.8 + ,1802 + ,1.2256 + ,2 + ,1601.7 + ,1526.8 + ,1.2015 + ,2 + ,1660.3 + ,1580.9 + ,1.1786 + ,2 + ,1954 + ,1634.8 + ,1.1856 + ,2.21 + ,1991.9 + ,1610.3 + ,1.2103 + ,2.25 + ,1881.4 + ,1712 + ,1.1938 + ,2.25 + ,2345.5 + ,1678.8 + ,1.202 + ,2.45 + ,1773.1 + ,1708.1 + ,1.2271 + ,2.5 + ,1719.2 + ,1680.6 + ,1.277 + ,2.5 + ,2240.9 + ,2056 + ,1.265 + ,2.64 + ,1816.4 + ,1624 + ,1.2684 + ,2.75 + ,2171.3 + ,2021.4 + ,1.2811 + ,2.93 + ,1823.3 + ,1861.1 + ,1.2727 + ,3 + ,2022.5 + ,1750.8 + ,1.2611 + ,3.17 + ,1991 + ,1767.5 + ,1.2881 + ,3.25 + ,1920 + ,1710.3 + ,1.3213 + ,3.39 + ,2168.4 + ,2151.5 + ,1.2999 + ,3.5 + ,2013.5 + ,2047.9 + ,1.3074 + ,3.5 + ,1790.8 + ,1915.4 + ,1.3242 + ,3.65 + ,1855.7 + ,1984.7 + ,1.3516 + ,3.75 + ,2074 + ,1896.5 + ,1.3511 + ,3.75 + ,2535.8 + ,2170.8 + ,1.3419 + ,3.9 + ,1837.2 + ,2139.9 + ,1.3716 + ,4 + ,1805.1 + ,2330.5 + ,1.3622 + ,4 + ,1785.7 + ,2121.8 + ,1.3896 + ,4 + ,2250 + ,2226.8 + ,1.4227 + ,4 + ,1959.7 + ,1857.9 + ,1.4684 + ,4 + ,1890.8 + ,2155.9 + ,1.457 + ,4 + ,2405.7 + ,2341.7 + ,1.4718 + ,4 + ,2090.3 + ,2290.2 + ,1.4748 + ,4 + ,1666.5 + ,2006.5 + ,1.5527 + ,4 + ,1803.5 + ,2111.9 + ,1.575 + ,4 + ,1793.8 + ,1731.3 + ,1.5557 + ,4 + ,1488.8 + ,1762.2 + ,1.5553 + ,4 + ,1545 + ,1863.2 + ,1.577 + ,4.18 + ,1369.9 + ,1943.5 + ,1.4975 + ,4.25 + ,1451.6 + ,1975.2 + ,1.4369 + ,4.25) + ,dim=c(4 + ,97) + ,dimnames=list(c('Uitvoer_naar_Amerika' + ,'Invoer_vanuit_Amerika' + ,'Wisselkoers_dollar_/_euro' + ,'Rentevoet') + ,1:97)) > y <- array(NA,dim=c(4,97),dimnames=list(c('Uitvoer_naar_Amerika','Invoer_vanuit_Amerika','Wisselkoers_dollar_/_euro','Rentevoet'),1:97)) > 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 97 members at h = 12536] |--[dendrogram w/ 2 branches and 38 members at h = 3565] | |--[dendrogram w/ 2 branches and 18 members at h = 978] | | |--[dendrogram w/ 2 branches and 9 members at h = 311] | | | |--[dendrogram w/ 2 branches and 4 members at h = 111] | | | | |--[dendrogram w/ 2 branches and 2 members at h = 13.9] | | | | | |--leaf "27" | | | | | `--leaf "37" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 23] | | | | |--leaf "35" | | | | `--leaf "62" | | | `--[dendrogram w/ 2 branches and 5 members at h = 198] | | | |--leaf "45" | | | `--[dendrogram w/ 2 branches and 4 members at h = 101] | | | |--leaf "44" | | | `--[dendrogram w/ 2 branches and 3 members at h = 82] | | | |--leaf "43" | | | `--[dendrogram w/ 2 branches and 2 members at h = 41.8] | | | |--leaf "42" | | | `--leaf "55" | | `--[dendrogram w/ 2 branches and 9 members at h = 454] | | |--[dendrogram w/ 2 branches and 6 members at h = 133] | | | |--[dendrogram w/ 2 branches and 2 members at h = 13.8] | | | | |--leaf "34" | | | | `--leaf "52" | | | `--[dendrogram w/ 2 branches and 4 members at h = 102] | | | |--leaf "33" | | | `--[dendrogram w/ 2 branches and 3 members at h = 44.3] | | | |--leaf "36" | | | `--[dendrogram w/ 2 branches and 2 members at h = 11.5] | | | |--leaf "2" | | | `--leaf "51" | | `--[dendrogram w/ 2 branches and 3 members at h = 245] | | |--leaf "16" | | `--[dendrogram w/ 2 branches and 2 members at h = 57.2] | | |--leaf "19" | | `--leaf "39" | `--[dendrogram w/ 2 branches and 20 members at h = 1619] | |--[dendrogram w/ 2 branches and 4 members at h = 216] | | |--[dendrogram w/ 2 branches and 2 members at h = 88.9] | | | |--leaf "1" | | | `--leaf "15" | | `--[dendrogram w/ 2 branches and 2 members at h = 155] | | |--leaf "3" | | `--leaf "11" | `--[dendrogram w/ 2 branches and 16 members at h = 1047] | |--[dendrogram w/ 2 branches and 7 members at h = 404] | | |--[dendrogram w/ 2 branches and 3 members at h = 81.2] | | | |--leaf "96" | | | `--[dendrogram w/ 2 branches and 2 members at h = 38.2] | | | |--leaf "6" | | | `--leaf "97" | | `--[dendrogram w/ 2 branches and 4 members at h = 112] | | |--leaf "95" | | `--[dendrogram w/ 2 branches and 3 members at h = 78.5] | | |--leaf "94" | | `--[dendrogram w/ 2 branches and 2 members at h = 40.5] | | |--leaf "5" | | `--leaf "10" | `--[dendrogram w/ 2 branches and 9 members at h = 507] | |--[dendrogram w/ 2 branches and 3 members at h = 88.3] | | |--leaf "8" | | `--[dendrogram w/ 2 branches and 2 members at h = 55.1] | | |--leaf "12" | | `--leaf "13" | `--[dendrogram w/ 2 branches and 6 members at h = 194] | |--[dendrogram w/ 2 branches and 3 members at h = 81] | | |--leaf "7" | | `--[dendrogram w/ 2 branches and 2 members at h = 22.5] | | |--leaf "14" | | `--leaf "17" | `--[dendrogram w/ 2 branches and 3 members at h = 117] | |--leaf "56" | `--[dendrogram w/ 2 branches and 2 members at h = 52.6] | |--leaf "9" | `--leaf "18" `--[dendrogram w/ 2 branches and 59 members at h = 7036] |--[dendrogram w/ 2 branches and 20 members at h = 2297] | |--[dendrogram w/ 2 branches and 7 members at h = 614] | | |--[dendrogram w/ 2 branches and 2 members at h = 215] | | | |--leaf "82" | | | `--leaf "89" | | `--[dendrogram w/ 2 branches and 5 members at h = 316] | | |--[dendrogram w/ 2 branches and 2 members at h = 77.7] | | | |--leaf "70" | | | `--leaf "72" | | `--[dendrogram w/ 2 branches and 3 members at h = 184] | | |--leaf "90" | | `--[dendrogram w/ 2 branches and 2 members at h = 111] | | |--leaf "77" | | `--leaf "86" | `--[dendrogram w/ 2 branches and 13 members at h = 938] | |--[dendrogram w/ 2 branches and 5 members at h = 288] | | |--leaf "84" | | `--[dendrogram w/ 2 branches and 4 members at h = 115] | | |--[dendrogram w/ 2 branches and 2 members at h = 20.4] | | | |--leaf "85" | | | `--leaf "92" | | `--[dendrogram w/ 2 branches and 2 members at h = 55.9] | | |--leaf "83" | | `--leaf "88" | `--[dendrogram w/ 2 branches and 8 members at h = 561] | |--[dendrogram w/ 2 branches and 4 members at h = 225] | | |--leaf "78" | | `--[dendrogram w/ 2 branches and 3 members at h = 140] | | |--leaf "81" | | `--[dendrogram w/ 2 branches and 2 members at h = 25.8] | | |--leaf "46" | | `--leaf "87" | `--[dendrogram w/ 2 branches and 4 members at h = 232] | |--leaf "91" | `--[dendrogram w/ 2 branches and 3 members at h = 127] | |--leaf "80" | `--[dendrogram w/ 2 branches and 2 members at h = 63.3] | |--leaf "73" | `--leaf "79" `--[dendrogram w/ 2 branches and 39 members at h = 2593] |--[dendrogram w/ 2 branches and 11 members at h = 755] | |--[dendrogram w/ 2 branches and 2 members at h = 110] | | |--leaf "29" | | `--leaf "67" | `--[dendrogram w/ 2 branches and 9 members at h = 349] | |--[dendrogram w/ 2 branches and 3 members at h = 52.1] | | |--leaf "64" | | `--[dendrogram w/ 2 branches and 2 members at h = 37.2] | | |--leaf "30" | | `--leaf "65" | `--[dendrogram w/ 2 branches and 6 members at h = 152] | |--[dendrogram w/ 2 branches and 2 members at h = 35.3] | | |--leaf "61" | | `--leaf "75" | `--[dendrogram w/ 2 branches and 4 members at h = 93.1] | |--leaf "60" | `--[dendrogram w/ 2 branches and 3 members at h = 71.5] | |--leaf "24" | `--[dendrogram w/ 2 branches and 2 members at h = 49.7] | |--leaf "49" | `--leaf "74" `--[dendrogram w/ 2 branches and 28 members at h = 1012] |--[dendrogram w/ 2 branches and 9 members at h = 220] | |--[dendrogram w/ 2 branches and 4 members at h = 74.3] | | |--leaf "58" | | `--[dendrogram w/ 2 branches and 3 members at h = 54.9] | | |--leaf "59" | | `--[dendrogram w/ 2 branches and 2 members at h = 31.1] | | |--leaf "68" | | `--leaf "93" | `--[dendrogram w/ 2 branches and 5 members at h = 196] | |--[dendrogram w/ 2 branches and 2 members at h = 38.7] | | |--leaf "66" | | `--leaf "76" | `--[dendrogram w/ 2 branches and 3 members at h = 72.4] | |--leaf "26" | `--[dendrogram w/ 2 branches and 2 members at h = 42.9] | |--leaf "23" | `--leaf "71" `--[dendrogram w/ 2 branches and 19 members at h = 807] |--[dendrogram w/ 2 branches and 7 members at h = 235] | |--[dendrogram w/ 2 branches and 4 members at h = 65.1] | | |--[dendrogram w/ 2 branches and 2 members at h = 28.1] | | | |--leaf "20" | | | `--leaf "41" | | `--[dendrogram w/ 2 branches and 2 members at h = 28.2] | | |--leaf "48" | | `--leaf "50" | `--[dendrogram w/ 2 branches and 3 members at h = 141] | |--leaf "40" | `--[dendrogram w/ 2 branches and 2 members at h = 45.7] | |--leaf "22" | `--leaf "31" `--[dendrogram w/ 2 branches and 12 members at h = 389] |--[dendrogram w/ 2 branches and 5 members at h = 114] | |--[dendrogram w/ 2 branches and 3 members at h = 40.5] | | |--leaf "47" | | `--[dendrogram w/ 2 branches and 2 members at h = 24.9] | | |--leaf "54" | | `--leaf "69" | `--[dendrogram w/ 2 branches and 2 members at h = 43.9] | |--leaf "25" | `--leaf "32" `--[dendrogram w/ 2 branches and 7 members at h = 159] |--[dendrogram w/ 2 branches and 3 members at h = 47] | |--leaf "57" | `--[dendrogram w/ 2 branches and 2 members at h = 15.5] | |--leaf "28" | `--leaf "63" `--[dendrogram w/ 2 branches and 4 members at h = 102] |--[dendrogram w/ 2 branches and 2 members at h = 35.7] | |--leaf "21" | `--leaf "38" `--[dendrogram w/ 2 branches and 2 members at h = 38.0] |--leaf "4" `--leaf "53" > mysub <- paste('Method: ',par1) > postscript(file="/var/www/html/rcomp/tmp/1me481226412318.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/2m8kg1226412318.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/3deqs1226412318.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/4e9dv1226412318.tab") + } > > system("convert tmp/1me481226412318.ps tmp/1me481226412318.png") > system("convert tmp/2m8kg1226412318.ps tmp/2m8kg1226412318.png") convert: unable to open image `tmp/2m8kg1226412318.ps': No such file or directory. convert: missing an image filename `tmp/2m8kg1226412318.png'. > > > proc.time() user system elapsed 0.955 0.213 1.177