R version 3.1.0 beta (2014-03-28 r65330) -- "Spring Dance" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu (32-bit) 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('GTM' + ,232.2 + ,49.0 + ,21.4 + ,67.6 + ,77.3 + ,49.9 + ,7.9 + ,12.9 + ,3.7 + ,77.3 + ,59.2 + ,16.8 + ,1.420 + ,0.1 + ,0.4 + ,0.8 + ,0.9 + ,0.9 + ,0.7 + ,0.8 + ,0.8 + ,0.8 + ,95.4 + ,4.6 + ,47.3 + ,48.1 + ,41.0 + ,4.2 + ,36.9 + ,'PRO' + ,47.0 + ,14.6 + ,15.2 + ,58.4 + ,44.4 + ,38.1 + ,3.2 + ,22.9 + ,4.4 + ,44.4 + ,34.3 + ,9.5 + ,86 + ,0.0 + ,0.5 + ,0.7 + ,0.8 + ,0.4 + ,0.6 + ,0.8 + ,0.7 + ,0.7 + ,96.7 + ,3.4 + ,51.9 + ,44.8 + ,43.4 + ,6.4 + ,37.1 + ,'SAC' + ,153.2 + ,29.7 + ,15.8 + ,21.2 + ,36.9 + ,10.1 + ,1.6 + ,13.9 + ,3.8 + ,36.9 + ,29.7 + ,6.6 + ,590 + ,0.4 + ,0.5 + ,0.8 + ,0.9 + ,0.8 + ,0.6 + ,0.8 + ,0.9 + ,0.8 + ,97.0 + ,3.0 + ,48.4 + ,48.7 + ,61.4 + ,10.7 + ,50.7 + ,'CHM' + ,76.4 + ,11.4 + ,7.4 + ,14.4 + ,35.8 + ,9.4 + ,0.8 + ,5.4 + ,1.3 + ,35.8 + ,26.4 + ,9.2 + ,325 + ,0.8 + ,0.6 + ,0.7 + ,0.8 + ,0.5 + ,0.4 + ,0.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.6 + ,14.9 + ,82 + ,0.0 + ,0.5 + ,0.7 + ,0.8 + ,0.4 + ,0.6 + ,0.7 + ,0.8 + ,0.7 + ,97.6 + ,2.4 + ,41.8 + ,55.8 + ,61.5 + ,25.0 + ,36.5 + ,'CHQ' + ,75.0 + ,11.4 + ,29.9 + ,96.2 + ,58.2 + ,58.7 + ,6.3 + ,38.3 + ,7.3 + ,58.2 + ,45.4 + ,11.1 + ,153 + ,0.1 + ,0.5 + ,0.6 + ,0.7 + ,0.3 + ,0.5 + ,0.6 + ,0.6 + ,0.6 + ,97.9 + ,2.1 + ,47.7 + ,50.3 + ,66.0 + ,22.0 + ,34.0 + ,'JAL' + ,12.4 + ,11.1 + ,12.4 + ,54.4 + ,35.0 + ,33.1 + ,4.8 + ,18.1 + ,5.1 + ,35.0 + ,29.0 + ,5.1 + ,154 + ,0.0 + ,0.6 + ,0.7 + ,0.8 + ,0.3 + ,0.5 + ,0.5 + ,0.6 + ,0.5 + ,97.9 + ,2.1 + ,42.6 + ,55.3 + ,73.4 + ,18.9 + ,54.6 + ,'JUT' + ,34.8 + ,11.7 + ,6.2 + ,61.3 + ,46.3 + ,42.8 + ,7.4 + ,14.0 + ,2.3 + ,46.3 + ,36.4 + ,9.7 + ,131 + ,0.0 + ,0.5 + ,0.7 + ,0.8 + ,0.3 + ,0.5 + ,0.7 + ,0.6 + ,0.6 + ,97.5 + ,2.5 + ,52.6 + ,45.0 + ,48.9 + ,14.3 + ,34.6) + ,dim=c(30 + ,22) + ,dimnames=list(c('DEP' + ,'Delitos' + ,'Capturas_Delitos' + ,'Armas_robadas' + ,'Homicidios' + ,'OtrasMuertes' + ,'HArmaFuego_M' + ,'HArmaFuego_F' + ,'HNoArmaFuegoM' + ,'HNoArmaFuegoF' + ,'OtrasMuertesT' + ,'OtrasMuertesH' + ,'OtrasMuertesM' + ,'DensidadPoblación' + ,'Etnicidad' + ,'Juventud' + ,'Escolaridad' + ,'Alfabetismo' + ,'Urbanidad' + ,'IH' + ,'ICV' + ,'ISP' + ,'IBH' + ,'Ocupados' + ,'Desocupados' + ,'Subocupados' + ,'OcupadosPlenos' + ,'PobrezaTotal' + ,'PobrezaExtrema' + ,'PobrezaNoExtrema') + ,1:22)) > y <- array(NA,dim=c(30,22),dimnames=list(c('DEP','Delitos','Capturas_Delitos','Armas_robadas','Homicidios','OtrasMuertes','HArmaFuego_M','HArmaFuego_F','HNoArmaFuegoM','HNoArmaFuegoF','OtrasMuertesT','OtrasMuertesH','OtrasMuertesM','DensidadPoblación','Etnicidad','Juventud','Escolaridad','Alfabetismo','Urbanidad','IH','ICV','ISP','IBH','Ocupados','Desocupados','Subocupados','OcupadosPlenos','PobrezaTotal','PobrezaExtrema','PobrezaNoExtrema'),1:22)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } There were 22 warnings (use warnings() to see them) > par7 = '0' > par6 = '0.5' > par5 = '0.5' > par4 = '0.5' > par3 = '1' > par2 = 'average' > par1 = 'euclidean' > ylab = 'Altura' > xlab = 'Departamentos' > main = 'Dendrogram' > par7 <- '0' > par6 <- '0.5' > par5 <- '0.5' > par4 <- '0.5' > par3 <- '1' > par2 <- 'average' > par1 <- 'euclidean' > #'GNU S' R Code compiled by R2WASP v. 1.2.291 () > #Author: root > #To cite this work: Wessa, P., (2012), Agglomerative Nesting (v1.0.3) 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 > # > 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.7575932 Order of objects: [1] 1 5 2 22 21 6 19 18 20 10 11 13 14 15 17 3 4 9 7 16 8 12 Merge: [,1] [,2] [1,] -7 -16 [2,] -10 -11 [3,] -13 -14 [4,] -2 -22 [5,] -6 -19 [6,] -4 -9 [7,] -15 -17 [8,] 5 -18 [9,] 4 -21 [10,] 1 -8 [11,] 8 -20 [12,] 9 11 [13,] 6 10 [14,] 2 3 [15,] 13 -12 [16,] 12 14 [17,] 16 7 [18,] -1 -5 [19,] 18 17 [20,] -3 15 [21,] 19 20 Height: [1] 178.34178 255.68422 50.93221 71.52923 95.24669 51.90346 68.38747 [8] 82.04970 127.47173 40.36344 106.23049 41.11405 140.74030 60.60394 [15] 318.24929 265.47560 60.04317 100.47926 30.47486 74.37034 107.84128 231 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 30.475 123.400 211.280 226.060 303.600 611.730 Metric : euclidean Number of objects : 22 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" "data" > postscript(file="/var/wessaorg/rcomp/tmp/1srnw1396620570.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/2br2r1396620570.ps",horizontal=F,onefile=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 > > #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/3rj6f1396620570.tab") > > try(system("convert tmp/1srnw1396620570.ps tmp/1srnw1396620570.png",intern=TRUE)) character(0) > try(system("convert tmp/2br2r1396620570.ps tmp/2br2r1396620570.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.566 0.508 3.050