En este trabajo voy a unir datos espaciales.Para esto primero voy a activar las librerias a utilizar.
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.0.5
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.2 v dplyr 1.0.7
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## Warning: package 'ggplot2' was built under R version 4.0.5
## Warning: package 'tibble' was built under R version 4.0.5
## Warning: package 'dplyr' was built under R version 4.0.5
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(sf)
## Warning: package 'sf' was built under R version 4.0.5
## Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
Voy a leer el primer dataset a utilizar.
cababarrios <- st_read("barrios_caba.geojson", stringsAsFactors = TRUE)
## Reading layer `barrios_caba' from data source
## `C:\Users\23377970594\Documents\MEU\TP 1 CSDATOS II\barrios_caba.geojson'
## using driver `GeoJSON'
## Simple feature collection with 48 features and 1 field
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -58.53152 ymin: -34.70529 xmax: -58.33515 ymax: -34.52649
## Geodetic CRS: WGS 84
sitioswifi <- read.csv("sitios-de-wifi.csv", stringsAsFactors = TRUE)
summary(sitioswifi)
## long lat id
## Min. :-58.53 Min. :-34.69 Min. : 1.0
## 1st Qu.:-58.46 1st Qu.:-34.64 1st Qu.: 362.0
## Median :-58.42 Median :-34.61 Median : 739.0
## Mean :-58.43 Mean :-34.61 Mean : 716.4
## 3rd Qu.:-58.39 3rd Qu.:-34.59 3rd Qu.:1119.0
## Max. :-58.35 Max. :-34.53 Max. :1392.0
##
## nombre
## Centro de Acción Familiar BartolomĆĀ© Mitre : 2
## Centro de DĆĀa Nro. 24 : 2
## Conservatorio S. M. "Manuel de Falla" : 2
## Conservatorio Superior de MĆĀŗsica Manuel de Falla: 2
## Dirección de Licencias : 2
## EMAD - Escuela Metropolitana de Arte DramĆĀ”tico : 2
## (Other) :885
## tipo etapa
## Espacio PĆĀŗblico :208 :220
## Hospitales y Centros de Salud:203 Ejecutados 2017 : 6
## Parques y Plazas :127 Gestión previa HRL:410
## Metrobus :112 Primera etapa HRL : 22
## Subte :100 Segunda etapa HRL :237
## Cultura : 37 Segunda Etapa HRL : 2
## (Other) :110
## etapa_obse estado subcategor
## Proyecto 125:125 Disponible :844 Parques y Plazas:108
## :123 Dsiponible : 36 CeSAC : 81
## Julio-2017 : 80 No Disponible: 17 Hospitales : 46
## Abril-17 : 61 Norte : 41
## jul-14 : 47 Sede Comunal : 38
## Diciembre-1 : 41 Hospital : 33
## (Other) :420 (Other) :550
## calle_nombre calle_altura calle_cruce
## : 31 Min. : 0 :648
## Cabildo : 23 1st Qu.: 0 ROLDAN, BELISARIO AV.: 6
## 9 DE JULIO AV. : 18 Median : 954 CASTAĆāARES AV. : 4
## Av. Juan B. Justo: 17 Mean : 1701 Jujuy : 4
## CORRIENTES AV. : 14 3rd Qu.: 3001 Perette : 4
## San MartĆĀn Av. : 12 Max. :10300 PUEYRREDON AV. : 4
## (Other) :782 (Other) :227
## barrio comuna codigo_postal codigo_postal_argentino
## San Nicolas : 78 Comuna 1 :163 Min. :1001 :294
## Palermo : 60 Comuna 4 :116 1st Qu.:1171 C1275AHG: 4
## Flores : 46 Comuna 8 : 76 Median :1407 C1405ALD: 4
## Parque Patricios: 45 Comuna 7 : 64 Mean :1308 C1429AAB: 4
## Balvanera : 40 Comuna 13: 61 3rd Qu.:1426 C1439GVN: 4
## Barracas : 37 Comuna 14: 60 Max. :1440 C1042AAO: 3
## (Other) :591 (Other) :357 NA's :291 (Other) :584
## objeto
## SITIO WIFI:897
##
##
##
##
##
##
Voy a identificar cuales son los puntos de wifi en la ciudad.
ggplot()+
geom_sf(data = cababarrios)+
geom_point(data = sitioswifi, aes(x=long, y=lat))
cababarrios1 <- st_read("barrios_caba2.geojson")
## Reading layer `barrios_caba' from data source
## `C:\Users\23377970594\Documents\MEU\TP 1 CSDATOS II\barrios_caba2.geojson'
## using driver `GeoJSON'
## Simple feature collection with 48 features and 1 field
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -58.53152 ymin: -34.70529 xmax: -58.33515 ymax: -34.52649
## Geodetic CRS: WGS 84
En el siguiente grafico se ve la cantidad de sitios Wifi por comuna
ggplot(sitioswifi)+
geom_bar(aes(x=comuna, weigth=id))+
labs(title = "Cantidad de sitios wifi en CABA")
## Warning: Ignoring unknown aesthetics: weigth
library(ggmap)
## Warning: package 'ggmap' was built under R version 4.0.5
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.