1) Read the file MGN_DPTO_POLITICO.shp in R using the function of rgdal to open SHP files. Name this object ORG_LEVEL_2. What is the class of this object? Plot ORG_LEVEL_2 using the color dark red. See the next pdf to find the typing of this color name:

Empezar a trabajar con un ambiente limpio en Rstudio

# To clean environment 
rm(list = ls(all.names = TRUE)) 
gc()
##          used (Mb) gc trigger (Mb) max used (Mb)
## Ncells 518315 27.7    1158800 61.9   644200 34.5
## Vcells 924484  7.1    8388608 64.0  1634597 12.5

Llamar todas las librerias que necesitamos

library("sp")

library("rgdal")
## Please note that rgdal will be retired by the end of 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
## 
## rgdal: version: 1.5-32, (SVN revision 1176)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.4.3, released 2022/04/22
## Path to GDAL shared files: C:/Users/luisc/AppData/Local/R/win-library/4.2/rgdal/gdal
## GDAL binary built with GEOS: TRUE 
## Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
## Path to PROJ shared files: C:/Users/luisc/AppData/Local/R/win-library/4.2/rgdal/proj
## PROJ CDN enabled: FALSE
## Linking to sp version:1.5-0
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
library("raster")

library("maptools")
## Checking rgeos availability: TRUE
## Please note that 'maptools' will be retired by the end of 2023,
## plan transition at your earliest convenience;
## some functionality will be moved to 'sp'.
library("tidyverse")
## ── Attaching packages
## ───────────────────────────────────────
## tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6     ✔ purrr   0.3.4
## ✔ tibble  3.1.8     ✔ dplyr   1.0.9
## ✔ tidyr   1.2.0     ✔ stringr 1.4.0
## ✔ readr   2.1.2     ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ tidyr::extract() masks raster::extract()
## ✖ dplyr::filter()  masks stats::filter()
## ✖ dplyr::lag()     masks stats::lag()
## ✖ dplyr::select()  masks raster::select()
library ('gdalUtilities')

library ("landscapemetrics") 
library("rgeos")
## rgeos version: 0.5-9, (SVN revision 684)
##  GEOS runtime version: 3.9.1-CAPI-1.14.2 
##  Please note that rgeos will be retired by the end of 2023,
## plan transition to sf functions using GEOS at your earliest convenience.
##  GEOS using OverlayNG
##  Linking to sp version: 1.5-0 
##  Polygon checking: TRUE
library("sf")
## Linking to GEOS 3.9.1, GDAL 3.4.3, PROJ 7.2.1; sf_use_s2() is TRUE
## 
## Attaching package: 'sf'
## The following object is masked from 'package:gdalUtilities':
## 
##     gdal_rasterize
getClass("Spatial") 
## Class "Spatial" [package "sp"]
## 
## Slots:
##                               
## Name:         bbox proj4string
## Class:      matrix         CRS
## 
## Known Subclasses: 
## Class "SpatialPoints", directly
## Class "SpatialMultiPoints", directly
## Class "SpatialGrid", directly
## Class "SpatialLines", directly
## Class "SpatialPolygons", directly
## Class "SpatialPointsDataFrame", by class "SpatialPoints", distance 2
## Class "SpatialPixels", by class "SpatialPoints", distance 2
## Class "SpatialMultiPointsDataFrame", by class "SpatialMultiPoints", distance 2
## Class "SpatialGridDataFrame", by class "SpatialGrid", distance 2
## Class "SpatialLinesDataFrame", by class "SpatialLines", distance 2
## Class "SpatialPixelsDataFrame", by class "SpatialPoints", distance 3
## Class "SpatialPolygonsDataFrame", by class "SpatialPolygons", distance 2

Leer el archivo MGN_DPTO_POLITICO. sp para abrir archivos shp.

crear objeto: ORG_LEVEL_2

library(rgdal)
 ORG_LEVEL_2 = readOGR(dsn = "C:/Users/luisc/Downloads", layer = "MGN_DPTO_POLITICO") #no .shp required
## OGR data source with driver: ESRI Shapefile 
## Source: "C:\Users\luisc\Downloads", layer: "MGN_DPTO_POLITICO"
## with 33 features
## It has 10 fields
## Integer64 fields read as strings:  DPTO_ANO_C DPTO_VGNC

La clase del objeto (ORG_LEVEL_2) es “SpatialPolygonsDataFrame”

summary(ORG_LEVEL_2)
## Object of class SpatialPolygonsDataFrame
## Coordinates:
##          min       max
## x -81.735621 -66.84722
## y  -4.229406  13.39473
## Is projected: FALSE 
## proj4string : [+proj=longlat +datum=WGS84 +no_defs]
## Data attributes:
##   DPTO_CCDGO         DPTO_CNMBR         DPTO_ANO_C         DPTO_ACT_A       
##  Length:33          Length:33          Length:33          Length:33         
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##    DPTO_NAREA         DPTO_CSMBL         DPTO_VGNC           SHAPE_AREA     
##  Min.   :    49.42   Length:33          Length:33          Min.   :0.00405  
##  1st Qu.: 20619.01   Class :character   Class :character   1st Qu.:1.67949  
##  Median : 24139.40   Mode  :character   Mode  :character   Median :1.96503  
##  Mean   : 34574.78                                         Mean   :2.81313  
##  3rd Qu.: 48353.22                                         3rd Qu.:3.93974  
##  Max.   :109497.05                                         Max.   :8.87748  
##                                                                             
##    SHAPE_LEN            AREA    
##  Min.   : 0.6853   Min.   : NA  
##  1st Qu.: 9.5497   1st Qu.: NA  
##  Median :12.5785   Median : NA  
##  Mean   :12.7108   Mean   :NaN  
##  3rd Qu.:17.2926   3rd Qu.: NA  
##  Max.   :25.3560   Max.   : NA  
##                    NA's   :33
class(ORG_LEVEL_2)
## [1] "SpatialPolygonsDataFrame"
## attr(,"package")
## [1] "sp"
plot(ORG_LEVEL_2)

Traza ORG_LEVEL_2 usando el color rojo oscuro.

plot(ORG_LEVEL_2, col ="dark red")

2) Show the Geographic Coordinate Systems of ORG_LEVEL_2. Built a vector called nombres with the names of ORG_LEVEL_2. What is the class of this object? Show the first five or six rows of the data.frame (attribute table) of ORG_LEVEL_2.

Coordenadas georgraficas de ORG_LEVEL_2

ORG_LEVEL_2@proj4string
## Coordinate Reference System:
## Deprecated Proj.4 representation: +proj=longlat +datum=WGS84 +no_defs 
## WKT2 2019 representation:
## GEOGCRS["WGS 84",
##     DATUM["World Geodetic System 1984",
##         ELLIPSOID["WGS 84",6378137,298.257223563,
##             LENGTHUNIT["metre",1]]],
##     PRIMEM["Greenwich",0,
##         ANGLEUNIT["degree",0.0174532925199433]],
##     CS[ellipsoidal,2],
##         AXIS["latitude",north,
##             ORDER[1],
##             ANGLEUNIT["degree",0.0174532925199433]],
##         AXIS["longitude",east,
##             ORDER[2],
##             ANGLEUNIT["degree",0.0174532925199433]],
##     ID["EPSG",4326]]
names(ORG_LEVEL_2)
##  [1] "DPTO_CCDGO" "DPTO_CNMBR" "DPTO_ANO_C" "DPTO_ACT_A" "DPTO_NAREA"
##  [6] "DPTO_CSMBL" "DPTO_VGNC"  "SHAPE_AREA" "SHAPE_LEN"  "AREA"

Vector nombres

Nombres <- c(names(ORG_LEVEL_2))
Nombres
##  [1] "DPTO_CCDGO" "DPTO_CNMBR" "DPTO_ANO_C" "DPTO_ACT_A" "DPTO_NAREA"
##  [6] "DPTO_CSMBL" "DPTO_VGNC"  "SHAPE_AREA" "SHAPE_LEN"  "AREA"

Clase del objeto

class(Nombres)
## [1] "character"

Primeras filas de los atributos

head(ORG_LEVEL_2)
##   DPTO_CCDGO DPTO_CNMBR DPTO_ANO_C                        DPTO_ACT_A DPTO_NAREA
## 0         05  ANTIOQUIA       1886     Constitucion Politica de 1886   62804.71
## 1         23    CÓRDOBA       1951 Ley 9 del 18 de Diciembre de 1951   25086.55
## 2         27      CHOCÓ       1947 Ley 13 del 3 de Noviembre de 1947   48353.22
## 3         70      SUCRE       1966    Ley 47 del 8 de Agosto de 1966   10591.85
## 4         08  ATLÁNTICO       1910                    Ley 21 de 1910    3313.81
## 5         13    BOLÍVAR       1886     Constitucion Politica de 1886   26719.21
##   DPTO_CSMBL DPTO_VGNC SHAPE_AREA SHAPE_LEN AREA
## 0          3      2020  5.1349154 21.443794   NA
## 1          3      2020  2.0575332  9.691516   NA
## 2          3      2020  3.9397431 20.634463   NA
## 3          3      2020  0.8708103  8.570869   NA
## 4          3      2020  0.2737698  2.544651   NA
## 5          3      2020  2.1955769 16.234817   NA
ORG_LEVEL_2@data
##    DPTO_CCDGO                                               DPTO_CNMBR
## 0          05                                                ANTIOQUIA
## 1          23                                                  CÓRDOBA
## 2          27                                                    CHOCÓ
## 3          70                                                    SUCRE
## 4          08                                                ATLÁNTICO
## 5          13                                                  BOLÍVAR
## 6          47                                                MAGDALENA
## 7          20                                                    CESAR
## 8          44                                               LA GUAJIRA
## 9          19                                                    CAUCA
## 10         76                                          VALLE DEL CAUCA
## 11         41                                                    HUILA
## 12         18                                                  CAQUETÁ
## 13         50                                                     META
## 14         15                                                   BOYACÁ
## 15         25                                             CUNDINAMARCA
## 16         17                                                   CALDAS
## 17         63                                                  QUINDIO
## 18         66                                                RISARALDA
## 19         73                                                   TOLIMA
## 20         52                                                   NARIÑO
## 21         54                                       NORTE DE SANTANDER
## 22         68                                                SANTANDER
## 23         85                                                 CASANARE
## 24         97                                                   VAUPÉS
## 25         86                                                 PUTUMAYO
## 26         94                                                  GUAINÍA
## 27         99                                                  VICHADA
## 28         91                                                 AMAZONAS
## 29         95                                                 GUAVIARE
## 30         88 ARCHIPIÉLAGO DE SAN ANDRÉS, PROVIDENCIA Y SANTA CATALINA
## 31         81                                                   ARAUCA
## 32         11                                             BOGOTÁ, D.C.
##    DPTO_ANO_C                                                   DPTO_ACT_A
## 0        1886                                Constitucion Politica de 1886
## 1        1951                            Ley 9 del 18 de Diciembre de 1951
## 2        1947                            Ley 13 del 3 de Noviembre de 1947
## 3        1966                               Ley 47 del 8 de Agosto de 1966
## 4        1910                                               Ley 21 de 1910
## 5        1886                                Constitucion Politica de 1886
## 6        1964                                                         1964
## 7        1967                                  Ley 25  21 de junio de 1967
## 8        1964               Acto Legislativo No. 1 de Diciembre 28 de 1964
## 9        1857                                          15 de junio de 1857
## 10       1910                        Decreto No 340 de 16 de Abril de 1910
## 11       1905                                               Ley 46 de 1905
## 12       1981                           Ley 78 del 29 de Diciembre de 1981
## 13       1959                          Ley 118 del 16 de Diciembre de 1959
## 14       1886                                Constitucion Politica de 1886
## 15       1886                                Constitucion Politica de 1886
## 16       1905                                          11 de Abril de 1905
## 17       1966                                             Ley 2 TM de 1966
## 18       1966                            Ley 70 del 1 de Diciembre de 1966
## 19       1909                                  Ley 65 de Noviembre de 1909
## 20       1904                                                Ley 1 de 1904
## 21       1910                                               Ley 25 de 1910
## 22       1910                                   Ley 25 14 de Julio de 1910
## 23       1991                     5 de Julio Constitucion Politica de 1991
## 24       1991                   Articulo 309 Constitucion Politica de 1991
## 25       1991                   Articulo 309 Constitucion Politica de 1991
## 26       1991                   Articulo 309 Constitucion Politica de 1991
## 27       1991                     5 de Julio Constitucion Politica de 1991
## 28       1991 Dcto. 2274 del 4 de Octubre de la Constitución Política 1991
## 29       1991                     5 de Julio Constitucion Politica de 1991
## 30       1991                   Artículo 310 Constitucion Politica de 1991
## 31       1991                     5 de Julio Constitucion Politica de 1991
## 32       1538                                Constitucion Politica de 1886
##      DPTO_NAREA DPTO_CSMBL DPTO_VGNC  SHAPE_AREA  SHAPE_LEN AREA
## 0   62804.71025          3      2020 5.134915412 21.4437936   NA
## 1   25086.54697          3      2020 2.057533219  9.6915160   NA
## 2   48353.21903          3      2020 3.939743093 20.6344626   NA
## 3   10591.84594          3      2020 0.870810349  8.5708693   NA
## 4    3313.81015          3      2020 0.273769829  2.5446507   NA
## 5   26719.21141          3      2020 2.195576862 16.2348170   NA
## 6   23135.93870          3      2020 1.909266273 10.8159579   NA
## 7   22565.30721          3      2020 1.858204407 12.5784592   NA
## 8   20619.00959          3      2020 1.706874490 10.7869049   NA
## 9   31242.91479          3      2020 2.534419222 13.9502629   NA
## 10  20665.54452          3      2020 1.679486591 12.6508699   NA
## 11  18141.66055          3      2020 1.474219177 10.3355646   NA
## 12  92831.12119          3      2020 7.540227855 21.2158385   NA
## 13  82799.17670          3      2020 6.733634872 18.1909537   NA
## 14  23138.04813          3      2020 1.888390832 15.9064914   NA
## 15  22370.48873          3      2020 1.823631133 13.1189510   NA
## 16   7425.22167          3      2020 0.605497805  6.6558442   NA
## 17   1933.57085          3      2020 0.157423729  2.5548254   NA
## 18   3556.77445          3      2020 0.289790632  4.8436149   NA
## 19  24139.40123          3      2020 1.965026841  9.5497261   NA
## 20  31497.57257          3      2020 2.548474605 12.8320974   NA
## 21  21856.75425          3      2020 1.792325441 10.7079284   NA
## 22  30561.51495          3      2020 2.499105532 11.8777470   NA
## 23  44394.23977          3      2020 3.615063148 12.1327536   NA
## 24  53299.28001          3      2020 4.313810177 20.1298337   NA
## 25  25976.28311          3      2020 2.107964833 12.7079225   NA
## 26  71289.35468          3      2020 5.747937395 21.1790507   NA
## 27 100063.37060          3      2020 8.100680492 17.2926130   NA
## 28 109497.05379          3      2020 8.877479989 25.3559774   NA
## 29  55575.23316          3      2020 4.511457243 19.3967890   NA
## 30     49.42425          3      2020 0.004049898  0.6852594   NA
## 31  23851.25706          3      2020 1.944156904  9.1245856   NA
## 32   1622.85260          3      2020 0.132207854  3.7604533   NA

3) Create a vector with the foundation date of the departments (variable DPTO_ANO_C), called FUNDACION. What are the foundation years of the youngest and oldest departments? I recommend the use of the functions max() and min() to know these two years. Create a SpatialPolygonsDataFrame with the youngest departments of Colombia (using ORG_LEVEL_2) and called JOVENSITOS. Also, you must plot JOVENSITOS. In this new object, JOVENSITOS, subset the largest and smallest departments and plot them (the variable or column SHAPE_AREA is the area of the departments).

Vector FUNDACION

FUNDACION <- c(ORG_LEVEL_2$DPTO_ANO_C)

Bogota D.C es el departamento mas antiguo y el Guaviare es el departamento mas joven

max(FUNDACION)
## [1] "1991"
min(FUNDACION)
## [1] "1538"

Se filtro por los departamentos mas jovenes

Se creao un SpatialPolygonsDataFrame con los departamentos más jóvenes de Colombia (usando ORG_LEVEL_2) y llamado JOVENSITOS

JOVENCITOS <- subset(ORG_LEVEL_2, ORG_LEVEL_2$DPTO_ANO_C >=1991)

plot(JOVENCITOS)

Size = mean(JOVENCITOS$SHAPE_AREA)
Size
## [1] 4.358067

En este nuevo objeto, JOVENSITOS, subdivide los departamentos más grandes y más pequeños y graficalos (la variable o columna SHAPE_AREA. es el área de los departamentos).

Grupo 1, departamentos mayores o iguales a la media

Grupo_1 = subset(JOVENCITOS, SHAPE_AREA >= mean(JOVENCITOS$SHAPE_AREA))
                 
plot(Grupo_1)

Grupo 2, departamentos menores o iguales a la media

Grupo_2 = subset(JOVENCITOS, SHAPE_AREA <= mean(JOVENCITOS$SHAPE_AREA))
                 
plot(Grupo_2)

4) Project ORG_LEVEL_2 to Transversal Mercator, called ORG_LEVEL_2_MER this new SpatialPolygonsDataFrame. The CRSobj of Transversal Mercator to use the function spTransform() is : “+proj=tmerc +lat_0=4.596200416666666 +lon_0=-74.07750791666666 +k=1 +x_0=1000000 +y_0=1000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs” Now create the centroids for the departments of ORG_LEVEL_2_MER (plot these centroids) and the matrix of their distances. Which one are the mean, median, standard deviation of the values of this matrix?

ORG_LEVEL_2_MER = spTransform(ORG_LEVEL_2, CRSobj="+proj=tmerc +lat_0=4.596200416666666 +lon_0=-74.07750791666666
 +k=1 +x_0=1000000 +y_0=1000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs")
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj
## = prefer_proj): Discarded datum Unknown based on GRS80 ellipsoid in Proj4
## definition
proj4string(ORG_LEVEL_2_MER)
## Warning in proj4string(ORG_LEVEL_2_MER): CRS object has comment, which is lost in output; in tests, see
## https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
## [1] "+proj=tmerc +lat_0=4.59620041666667 +lon_0=-74.0775079166667 +k=1 +x_0=1000000 +y_0=1000000 +ellps=GRS80 +units=m +no_defs"

Se creo los centroides para los departamentos de ORG_LEVEL_2_MER (trazar estos centroides) y la matriz de sus distancias.

library(rgeos)
CENT_ORG_LEVEL_2_MER = gCentroid(ORG_LEVEL_2_MER, byid = T)

plot(ORG_LEVEL_2_MER)

plot(CENT_ORG_LEVEL_2_MER, add= T, col = "blue3")

Matriz de distancia de la cuatro primeras filas

dist_matrix <- gDistance(spgeom1 = CENT_ORG_LEVEL_2_MER, spgeom2 = NULL, byid=T)

dist_matrix[1:4, 1:4]
##          0        1        2        3
## 0      0.0 160792.0 186296.6 242240.7
## 1 160792.0      0.0 295467.1 108453.1
## 2 186296.6 295467.1      0.0 399800.9
## 3 242240.7 108453.1 399800.9      0.0

Matriz de distancia completa

dist_matrix
##            0         1         2          3          4          5          6
## 0        0.0  160792.0  186296.6  242240.73  420526.76  232796.49  394664.51
## 1   160792.0       0.0  295467.1  108453.13  272135.53  147838.06  268163.68
## 2   186296.6  295467.1       0.0  399800.86  566857.20  409665.27  559795.50
## 3   242240.7  108453.1  399800.9       0.00  179035.18   75218.75  160431.42
## 4   420526.8  272135.5  566857.2  179035.18       0.00  219700.02   90514.05
## 5   232796.5  147838.1  409665.3   75218.75  219700.02       0.00  168409.25
## 6   394664.5  268163.7  559795.5  160431.42   90514.05  168409.25       0.00
## 7   366569.8  281985.1  547631.1  182413.01  202737.77  139557.31  113345.52
## 8   610285.1  504937.4  787572.3  396649.15  290747.70  378449.55  242148.22
## 9   519957.1  669577.3  392976.9  761868.14  938961.90  747642.25  913524.94
## 10  355154.3  504380.7  235497.9  596762.69  773658.17  584495.05  749382.48
## 11  481507.5  640764.3  402457.8  720359.23  899376.14  693191.06  861587.83
## 12  696832.1  856922.7  655024.4  919498.08 1094627.21  877204.25 1041915.27
## 13  488321.3  634604.0  527730.0  672350.08  836532.53  617130.73  772205.45
## 14  300512.0  412105.2  424952.4  425813.16  579506.25  362903.14  510619.21
## 15  283334.8  433497.4  338126.4  482155.90  654361.27  435815.31  599986.70
## 16  177138.8  337929.0  192370.4  412348.06  591303.04  386452.33  554561.52
## 17  273291.2  431934.2  215069.5  513915.50  692862.17  492017.52  659668.26
## 18  205765.8  362352.3  154181.6  447810.98  626288.12  430911.59  597121.40
## 19  321298.4  481964.8  281748.8  556639.59  735431.45  527378.16  695787.22
## 20  645408.8  786000.7  495472.9  884156.60 1057955.03  877049.64 1039903.60
## 21  323334.4  322090.2  507188.4  267732.20  366037.95  192862.30  282306.17
## 22  231210.6  314152.0  390600.8  317526.52  469677.43  253135.83  402155.03
## 23  469780.8  566832.3  594020.5  560357.96  691072.06  489318.44  610734.49
## 24  889475.6 1031939.3  919611.5 1059229.26 1212233.61  997147.39 1138693.92
## 25  716452.3  874624.2  619508.0  956233.40 1135268.04  929141.84 1097550.79
## 26  881749.8  993578.6  970010.7  989383.05 1112462.09  917590.00 1028041.05
## 27  724410.0  813129.0  845520.8  792975.11  900673.05  718755.38  813620.41
## 28 1040025.9 1194748.5 1025695.1 1240217.41 1405590.55 1186185.36 1340052.80
## 29  671567.5  819285.4  694829.7  855940.09 1017573.64  798876.10  950235.64
## 30  936212.7  810162.2  926512.8  826015.89  762517.22  901096.31  851263.14
## 31  510115.0  568439.3  664417.2  533980.89  632697.25  458858.65  545284.28
## 32  326507.1  481293.0  354620.5  535112.96  708793.03  490946.18  655932.98
##            7         8         9        10        11        12        13
## 0   366569.8  610285.1  519957.1  355154.3  481507.5  696832.1  488321.3
## 1   281985.1  504937.4  669577.3  504380.7  640764.3  856922.7  634604.0
## 2   547631.1  787572.3  392976.9  235497.9  402457.8  655024.4  527730.0
## 3   182413.0  396649.2  761868.1  596762.7  720359.2  919498.1  672350.1
## 4   202737.8  290747.7  938961.9  773658.2  899376.1 1094627.2  836532.5
## 5   139557.3  378449.6  747642.2  584495.1  693191.1  877204.2  617130.7
## 6   113345.5  242148.2  913524.9  749382.5  861587.8 1041915.3  772205.4
## 7        0.0  245628.2  870349.8  710192.9  803589.6  964018.0  682361.2
## 8   245628.2       0.0 1115548.1  955801.0 1044945.4 1189865.4  895697.7
## 9   870349.8 1115548.1       0.0  165324.8  139290.7  362384.0  448537.3
## 10  710192.9  955801.0  165324.8       0.0  176442.2  439247.6  403728.7
## 11  803589.6 1044945.4  139290.7  176442.2       0.0  263621.5  310509.5
## 12  964018.0 1189865.4  362384.0  439247.6  263621.5       0.0  306843.7
## 13  682361.2  895697.7  448537.3  403728.7  310509.5  306843.7       0.0
## 14  418228.7  634962.4  557355.3  434430.5  449164.6  555432.9  264213.1
## 15  524959.2  758504.5  404877.5  289306.7  299074.6  441929.9  205412.2
## 16  504041.8  748856.1  366932.0  212251.7  308201.7  520813.7  341806.1
## 17  610927.5  855714.6  260405.6  113374.0  208897.9  444432.4  329677.3
## 18  555241.3  800832.2  316731.4  154998.9  279533.2  514611.6  374750.4
## 19  637972.6  880192.6  251499.0  141688.7  166070.6  382353.3  269473.4
## 20 1004539.6 1250167.8  148142.8  294618.0  277522.6  442574.5  587151.1
## 21  174100.9  377540.5  766961.7  617857.9  680484.5  812378.8  519780.3
## 22  314331.8  541779.6  602623.7  459784.3  512046.7  650624.6  370215.9
## 23  503590.9  678232.4  668846.2  571970.0  542264.2  570253.0  265926.2
## 24 1036952.0 1216834.0  723792.9  752290.3  598439.7  379817.7  401657.3
## 25 1037392.4 1276853.8  240640.9  384010.3  236132.4  214590.0  461490.3
## 26  916602.4 1048793.5  892568.0  866339.2  754006.1  611333.7  462704.1
## 27  700707.1  819803.0  863201.2  795264.3  726219.8  664720.2  416078.3
## 28 1246320.0 1445013.2  736037.0  818260.6  643515.2  380127.2  569066.4
## 29  855782.7 1057463.8  525235.6  533117.5  391165.7  237767.0  184744.0
## 30  956739.6 1008510.7 1279656.6 1148946.6 1323989.3 1581210.3 1422125.1
## 31  432309.5  566635.0  797541.1  685000.9  677208.1  717233.8  412594.6
## 32  581831.6  815258.5  362536.0  264584.6  248261.8  386270.7  173590.9
##           14        15         16         17         18         19        20
## 0   300512.0  283334.8  177138.76  273291.21  205765.81  321298.40  645408.8
## 1   412105.2  433497.4  337929.05  431934.23  362352.32  481964.76  786000.7
## 2   424952.4  338126.4  192370.44  215069.50  154181.58  281748.83  495472.9
## 3   425813.2  482155.9  412348.06  513915.50  447810.98  556639.59  884156.6
## 4   579506.3  654361.3  591303.04  692862.17  626288.12  735431.45 1057955.0
## 5   362903.1  435815.3  386452.33  492017.52  430911.59  527378.16  877049.6
## 6   510619.2  599986.7  554561.52  659668.26  597121.40  695787.22 1039903.6
## 7   418228.7  524959.2  504041.81  610927.48  555241.33  637972.64 1004539.6
## 8   634962.4  758504.5  748856.05  855714.55  800832.19  880192.56 1250167.8
## 9   557355.3  404877.5  366932.00  260405.62  316731.37  251498.96  148142.8
## 10  434430.5  289306.7  212251.68  113374.02  154998.95  141688.72  294618.0
## 11  449164.6  299074.6  308201.71  208897.92  279533.25  166070.60  277522.6
## 12  555432.9  441929.9  520813.69  444432.44  514611.55  382353.30  442574.5
## 13  264213.1  205412.2  341806.10  329677.25  374750.41  269473.43  587151.1
## 14       0.0  152564.7  248981.48  321978.11  313191.06  306916.11  705200.6
## 15  152564.7       0.0  145848.69  181310.10  195615.06  155430.97  552822.0
## 16  248981.5  145848.7       0.00  106888.07   65872.17  144752.49  505470.1
## 17  321978.1  181310.1  106888.07       0.00   71519.21   66968.01  401044.9
## 18  313191.1  195615.1   65872.17   71519.21       0.00  133023.69  449573.7
## 19  306916.1  155431.0  144752.49   66968.01  133023.69       0.00  398736.6
## 20  705200.6  552822.0  505470.14  401044.93  449573.75  398736.58       0.0
## 21  257512.2  385909.6  405681.38  508477.74  467022.86  520292.93  909519.6
## 22  109918.5  217555.9  250955.98  347680.39  315884.96  353492.56  747225.7
## 23  171368.1  284200.4  410844.12  465509.44  471539.27  432935.47  815763.2
## 24  634298.6  607046.1  740581.55  709319.79  765472.02  643019.75  820552.4
## 25  663597.8  521497.7  544284.30  443169.61  512292.91  401772.29  256341.2
## 26  584330.9  631886.6  777676.69  788284.73  823735.97  731185.41 1016711.4
## 27  426174.1  520496.9  657953.30  697764.50  714933.33  653593.62 1003210.1
## 28  829644.1  761680.9  871726.91  811200.29  878131.08  745525.39  788938.1
## 29  439617.8  388240.0  517287.27  484842.99  540710.13  418807.00  640540.9
## 30 1221443.4 1216832.3 1086319.72 1140184.93 1073409.13 1205774.12 1324700.7
## 31  252369.5  397202.6  499644.76  573466.79  564678.23  552230.32  945557.7
## 32  201007.9   56917.7  168753.56  168168.30  202907.56  123362.04  510599.4
##           21        22        23        24        25        26        27
## 0   323334.4  231210.6  469780.8  889475.6  716452.3  881749.8  724410.0
## 1   322090.2  314152.0  566832.3 1031939.3  874624.2  993578.6  813129.0
## 2   507188.4  390600.8  594020.5  919611.5  619508.0  970010.7  845520.8
## 3   267732.2  317526.5  560358.0 1059229.3  956233.4  989383.0  792975.1
## 4   366038.0  469677.4  691072.1 1212233.6 1135268.0 1112462.1  900673.1
## 5   192862.3  253135.8  489318.4  997147.4  929141.8  917590.0  718755.4
## 6   282306.2  402155.0  610734.5 1138693.9 1097550.8 1028041.0  813620.4
## 7   174100.9  314331.8  503590.9 1036952.0 1037392.4  916602.4  700707.1
## 8   377540.5  541779.6  678232.4 1216834.0 1276853.8 1048793.5  819803.0
## 9   766961.7  602623.7  668846.2  723792.9  240640.9  892568.0  863201.2
## 10  617857.9  459784.3  571970.0  752290.3  384010.3  866339.2  795264.3
## 11  680484.5  512046.7  542264.2  598439.7  236132.4  754006.1  726219.8
## 12  812378.8  650624.6  570253.0  379817.7  214590.0  611333.7  664720.2
## 13  519780.3  370215.9  265926.2  401657.3  461490.3  462704.1  416078.3
## 14  257512.2  109918.5  171368.1  634298.6  663597.8  584330.9  426174.1
## 15  385909.6  217555.9  284200.4  607046.1  521497.7  631886.6  520496.9
## 16  405681.4  250956.0  410844.1  740581.6  544284.3  777676.7  657953.3
## 17  508477.7  347680.4  465509.4  709319.8  443169.6  788284.7  697764.5
## 18  467022.9  315885.0  471539.3  765472.0  512292.9  823736.0  714933.3
## 19  520292.9  353492.6  432935.5  643019.8  401772.3  731185.4  653593.6
## 20  909519.6  747225.7  815763.2  820552.4  256341.2 1016711.4 1003210.1
## 21       0.0  168728.2  329545.2  863741.3  907306.6  746481.5  536422.4
## 22  168728.2       0.0  252747.8  744016.2  738689.1  679966.3  502123.2
## 23  329545.2  252747.8       0.0  539534.5  723703.0  429301.7  254986.3
## 24  863741.3  744016.2  539534.5       0.0  590183.9  302209.1  468921.6
## 25  907306.6  738689.1  723703.0  590183.9       0.0  823955.9  858341.8
## 26  746481.5  679966.3  429301.7  302209.1  823955.9       0.0  230422.2
## 27  536422.4  502123.2  254986.3  468921.6  858341.8  230422.2       0.0
## 28 1077745.9  937978.2  769554.8  264462.1  533110.4  560697.3  731856.5
## 29  687597.8  548577.3  389501.9  224801.2  445860.3  379962.5  432326.3
## 30 1091621.7 1123892.6 1376059.6 1823755.9 1519996.0 1803705.7 1617282.4
## 31  270652.2  279175.9  146998.2  657728.4  867837.4  488675.4  268403.6
## 32  441921.7  273949.5  310509.1  571990.8  466137.1  622527.5  531644.6
##           28        29        30        31        32
## 0  1040025.9  671567.5  936212.7  510115.0  326507.1
## 1  1194748.5  819285.4  810162.2  568439.3  481293.0
## 2  1025695.1  694829.7  926512.8  664417.2  354620.5
## 3  1240217.4  855940.1  826015.9  533980.9  535113.0
## 4  1405590.5 1017573.6  762517.2  632697.2  708793.0
## 5  1186185.4  798876.1  901096.3  458858.6  490946.2
## 6  1340052.8  950235.6  851263.1  545284.3  655933.0
## 7  1246320.0  855782.7  956739.6  432309.5  581831.6
## 8  1445013.2 1057463.8 1008510.7  566635.0  815258.5
## 9   736037.0  525235.6 1279656.6  797541.1  362536.0
## 10  818260.6  533117.5 1148946.6  685000.9  264584.6
## 11  643515.2  391165.7 1323989.3  677208.1  248261.8
## 12  380127.2  237767.0 1581210.3  717233.8  386270.7
## 13  569066.4  184744.0 1422125.1  412594.6  173590.9
## 14  829644.1  439617.8 1221443.4  252369.5  201007.9
## 15  761680.9  388240.0 1216832.3  397202.6   56917.7
## 16  871726.9  517287.3 1086319.7  499644.8  168753.6
## 17  811200.3  484843.0 1140184.9  573466.8  168168.3
## 18  878131.1  540710.1 1073409.1  564678.2  202907.6
## 19  745525.4  418807.0 1205774.1  552230.3  123362.0
## 20  788938.1  640540.9 1324700.7  945557.7  510599.4
## 21 1077745.9  687597.8 1091621.7  270652.2  441921.7
## 22  937978.2  548577.3 1123892.6  279175.9  273949.5
## 23  769554.8  389501.9 1376059.6  146998.2  310509.1
## 24  264462.1  224801.2 1823755.9  657728.4  571990.8
## 25  533110.4  445860.3 1519996.0  867837.4  466137.1
## 26  560697.3  379962.5 1803705.7  488675.4  622527.5
## 27  731856.5  432326.3 1617282.4  268403.6  531644.6
## 28       0.0  390538.3 1951285.3  900654.5  713871.3
## 29  390538.3       0.0 1602553.3  530118.2  349345.7
## 30 1951285.3 1602553.3       0.0 1359953.2 1253249.2
## 31  900654.5  530118.2 1359953.2       0.0  435017.4
## 32  713871.3  349345.7 1253249.2  435017.4       0.0

media, mediana y desviacion estandar

mean(dist_matrix)
## [1] 574993.6
median(dist_matrix)
## [1] 531644.6
sd(dist_matrix)
## [1] 333192.5