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(1,20,5,2,60,3,2,75,4,2,75,4,1,15,3,2,40,3,1,40,4,2,50,4,2,30,4,2,30,3,2,30,3,2,20,4,2,90,3,2,25,3,1,60,3,2,30,2,2,60,3,2,150,3,1,30,4,2,40,3,2,50,3,2,20,3,2,45,4,1,45,2,1,30,4,2,30,3,3,75,4,1,60,3,3,60,3,2,120,3,2,35,4,2,70,3,2,50,3,2,25,4,2,45,3,1,20,5,2,45,4,2,45,4,2,55,4,2,45,4,2,35,3,2,60,3,1,40,3,2,45,5,2,55,3,2,40,3,2,40,3,2,20,3,1,20,3,2,50,4,2,20,3),dim=c(3,51),dimnames=list(c('difficulty','preperationtime','ranking'),1:51)) > y <- array(NA,dim=c(3,51),dimnames=list(c('difficulty','preperationtime','ranking'),1:51)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par7 = '-0.5' > par6 = '0' > par5 = '0.5' > par4 = '0.5' > par3 = '1' > par2 = 'single' > par1 = 'euclidean' > 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), Agglomerative Nesting (v1.0.1) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_agglomerativehierarchicalclustering.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.numeric(par3) > par4 <- as.numeric(par4) > par5 <- as.numeric(par5) > par6 <- as.numeric(par6) > par7 <- as.numeric(par7) > library(cluster) > if (par2 == 'flexible') + { + if (par3 == 1) pm <- c(par4) + if (par3 == 3) pm <- c(par4,par5,par6) + if (par3 == 4) pm <- c(par4,par5,par6,par7) + ag <- agnes(t(y),metric=par1,method=par2,par.method=pm) + } else { + ag <- agnes(t(y),metric=par1,method=par2) + } > mysub <- paste('Method: ',par2) > summary(ag) Object of class `agnes' from call: agnes(x = t(y), metric = par1, method = par2) Agglomerative coefficient: 0.9329761 Order of objects: [1] 1 36 12 22 48 51 49 5 2 17 42 29 15 28 6 20 46 47 7 43 9 19 25 10 11 [26] 26 16 31 41 14 34 8 50 21 33 39 45 23 37 38 40 44 35 24 3 4 27 32 13 18 [51] 30 Merge: [,1] [,2] [1,] -48 -51 [2,] -46 -47 [3,] -38 -40 [4,] -37 3 [5,] -23 4 [6,] -22 1 [7,] -21 -33 [8,] -20 2 [9,] -19 -25 [10,] -17 -42 [11,] -15 -28 [12,] -11 -26 [13,] -10 12 [14,] -8 -50 [15,] -6 8 [16,] -3 -4 [17,] -2 10 [18,] -1 -36 [19,] -39 -45 [20,] -31 -41 [21,] 5 -44 [22,] 21 -35 [23,] 6 -49 [24,] -14 -34 [25,] -12 23 [26,] 13 -16 [27,] -9 9 [28,] 27 26 [29,] 14 7 [30,] -7 -43 [31,] 15 30 [32,] 16 -27 [33,] 17 -29 [34,] 33 11 [35,] 22 -24 [36,] 18 25 [37,] 28 20 [38,] 37 24 [39,] 29 19 [40,] 39 35 [41,] 31 38 [42,] 41 40 [43,] 34 42 [44,] 36 -5 [45,] 44 43 [46,] 32 -32 [47,] 45 46 [48,] 47 -13 [49,] -18 -30 [50,] 48 49 Height: [1] 0.000000 1.414214 1.000000 0.000000 0.000000 1.000000 5.000000 [8] 5.000000 0.000000 0.000000 1.000000 1.000000 0.000000 5.000000 [15] 0.000000 0.000000 0.000000 1.000000 1.000000 5.000000 1.000000 [22] 0.000000 1.000000 0.000000 0.000000 1.000000 5.000000 1.000000 [29] 5.000000 1.000000 5.000000 0.000000 1.000000 0.000000 5.000000 [36] 1.000000 5.000000 0.000000 0.000000 0.000000 1.000000 1.000000 [43] 1.414214 10.000000 0.000000 1.000000 5.099020 15.033296 30.000000 [50] 30.000000 1275 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.000 10.050 20.000 25.568 30.058 135.000 Metric : euclidean Number of objects : 51 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" "data" > postscript(file="/var/www/html/rcomp/tmp/1whf81196051059.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(ag,which.plots=2,main=main,sub=mysub,xlab=xlab,ylab=ylab) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2nnkw1196051059.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(ag,which.plots=1,main='Banner',sub=mysub,xlab=ylab,ylab=xlab) > dev.off() null device 1 > load(file='/var/www/html/rcomp/createtable') > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Agglomerative Nesting (Hierarchical Clustering)',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Agglomerative Coefficient',header=TRUE) > a<-table.element(a,ag$ac) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/3xc0d1196051059.tab") > > system("convert tmp/1whf81196051059.ps tmp/1whf81196051059.png") > system("convert tmp/2nnkw1196051059.ps tmp/2nnkw1196051059.png") > > > proc.time() user system elapsed 0.811 0.312 1.115