Examen

Author

Leslie Avila

Instalación de Paquetes

install.packages(“REAT”)

install.packpages(“spdep”)

install.packpages(“gridExtra”)

install.packpages(“sp”) proporciona clases y métodos para datos espaciales

install.packpages(“readxl”)

install.packpages(“RColorBrewer”)Herramienta para crear paletas de colores de alta calidad, diseñadas para gráficos de datos

install.packpages(“RColorBrewer”)

install.packpages(“spdep”)

install.packpages(“leaflet”) herramienta para crear mapas interactivos en la web

install.packpages(“magrittr”) se utiliza para simplificar la manipulación de datos y la creación de gráficos.

install.packpages(“dplyr”) ggplot2

install.packpages(“ggplot2”) spatialEco

install.packpages(“spatialEco”) proporciona herramientas para el análisis ecológico espacial, específicamente diseñado para trabajar con datos raster y datos vectoriales.

install.packpages(“stargazer”)

install.packpages(“readr”)

install.packpages(“sf”)permite trabajar con datos geoespaciales vectoriales.

install.packages(“leaflet.extras”)

Librerías requeridas

library(spdep)

library(MASS)

library(foreign)

library(“gridExtra”)

library(sp)

library(readxl)

library(RColorBrewer)

library(spdep)

library(leaflet)

library(magrittr)

library(dplyr)

library(ggplot2)

library(spatialEco)

library(stargazer)

library(readr)

library(sf)

library(leaflet.extras)

Para leer archivos shapes y transformarlo en objeto Shape y DataFrame:

setwd("C:/Users/InnoVausuario/Desktop/LESLIE UNL MAESTRIA/ANALYTICS/Examen/nxcantones_V2-20250608T013535Z-1-001/nxcantones_V2")
library(spdep)
Cargando paquete requerido: spData
To access larger datasets in this package, install the spDataLarge
package with: `install.packages('spDataLarge',
repos='https://nowosad.github.io/drat/', type='source')`
Cargando paquete requerido: sf
Linking to GEOS 3.13.0, GDAL 3.10.1, PROJ 9.5.1; sf_use_s2() is TRUE
shape_canton <- st_read("NXCantones.shp")
Reading layer `NXCantones' from data source 
  `C:\Users\InnoVausuario\Desktop\LESLIE UNL MAESTRIA\ANALYTICS\Examen\nxcantones_V2-20250608T013535Z-1-001\nxcantones_V2\NXCantones.shp' 
  using driver `ESRI Shapefile'
Simple feature collection with 221 features and 12 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -732143.5 ymin: 9445216 xmax: 1147852 ymax: 10189400
Projected CRS: WGS 84 / UTM zone 17S
print(shape_canton)
Simple feature collection with 221 features and 12 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -732143.5 ymin: 9445216 xmax: 1147852 ymax: 10189400
Projected CRS: WGS 84 / UTM zone 17S
First 10 features:
    D_R D_R_B D_R_A DPA_VALOR DPA_ANIO DPA_CANTON ID_CANTON DPA_DESCAN
1  <NA>  <NA>  <NA>         0     2011       0101       101         NA
2  <NA>  <NA>  <NA>         0     2011       0102       102         NA
3  <NA>  <NA>  <NA>         0     2011       0103       103         NA
4  <NA>  <NA>  <NA>         0     2011       0104       104         NA
5  <NA>  <NA>  <NA>         0     2011       0105       105         NA
6  <NA>  <NA>  <NA>         0     2011       0106       106         NA
7  <NA>  <NA>  <NA>         0     2011       0107       107         NA
8  <NA>  <NA>  <NA>         0     2011       0108       108         NA
9  <NA>  <NA>  <NA>         0     2011       0109       109         NA
10 <NA>  <NA>  <NA>         0     2011       0110       110         NA
   DPA_PROVIN DPA_DESPRO CODIGO       CANTON                       geometry
1          01      AZUAY    101       Cuenca MULTIPOLYGON (((678670.4 97...
2          01      AZUAY    102        Giron MULTIPOLYGON (((719040.2 96...
3          01      AZUAY    103     Gualaceo MULTIPOLYGON (((763237.9 96...
4          01      AZUAY    104        Nabon MULTIPOLYGON (((729367 9636...
5          01      AZUAY    105        Paute MULTIPOLYGON (((762177.3 96...
6          01      AZUAY    106       Pucara MULTIPOLYGON (((669285.4 96...
7          01      AZUAY    107 San Fernando MULTIPOLYGON (((696094.9 96...
8          01      AZUAY    108 Santa Isabel MULTIPOLYGON (((688511 9660...
9          01      AZUAY    109       Sigsig MULTIPOLYGON (((747464.4 96...
10         01      AZUAY    110       O\xa4a MULTIPOLYGON (((716412.7 96...