Cargamos las librerías, que vamos a ir usando a lo largo de todo el desarrollo
library("tidyverse")
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.7 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.0
## ✔ readr 2.1.2 ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library("ggplot2")
library("sf")
## Linking to GEOS 3.9.1, GDAL 3.3.2, PROJ 7.2.1; sf_use_s2() is TRUE
library("osmdata")
## Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
library("rmarkdown")
library("lubridate")
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library("ggmap")
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
library("mapview")
library("hrbrthemes")
## NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
## Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
## if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
library("RColorBrewer")
library("readr")
library("leaflet")
library("XML")
## Warning: package 'XML' was built under R version 4.2.1
library("osmextract")
## Warning: package 'osmextract' was built under R version 4.2.1
## Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright.
## Check the package website, https://docs.ropensci.org/osmextract/, for more details.
library("ggmap")
library("forcats")
Cargamos el dataset de las obras en CABA y filtramos las que no tienen ni lon ni lat.
obras_CABA = read.csv("https://cdn.buenosaires.gob.ar/datosabiertos/datasets/agencia-gubernamental-de-control/obras-iniciadas/obras-iniciadas.csv")
obras_CABA = filter(obras_CABA, long !="na", lat !="na")
Hacemos que el CSV sea un SF
obras_CABA = st_as_sf(x = obras_CABA, coords = c("long", "lat"), crs = 4326)
Realizamos un análisis exploratorio para ver si los puntos nos pueden decir algo
mapview(obras_CABA, color = "red", legend = FALSE)