Skip to content

Instantly share code, notes, and snippets.

@jbkunst
Created November 3, 2020 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbkunst/b6f21d82926576b6da698f9dfeba9706 to your computer and use it in GitHub Desktop.
Save jbkunst/b6f21d82926576b6da698f9dfeba9706 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(readxl)
dbip <- read_xlsx("data/pcma20201028oficio-47702013.xlsx", skip = 7)
# como leer más de una hoja
# readxl::excel_sheets()
# readxl::excel_sheets("data/pcma20201028oficio-47702013.xlsx")
dbip
glimpse(dbip)
dbip <- dbip %>%
mutate(
LONGITUD = as.numeric(LONGITUD),
LATITUD = as.numeric(LATITUD)
)
# nombres con espacio se debe utilizar con la tilde de acento grave
dbip <- dbip %>%
mutate(
atiende_sabado = str_detect(`HORARIO REFERENCIAL`, "Sab|Sáb|SAB|SÁB")
)
dbip
glimpse(dbip)
saveRDS(dbip, "data/dbip.rds")
# saveRDS(list(dbip, c(12312, 123)), "")
# exploracion leaflet
library(leaflet)
data("quakes")
# Show first 20 rows from the `quakes` dataset
leaflet(data = quakes[1:20,]) %>%
addTiles() %>%
addMarkers(~long, ~lat, popup = ~as.character(mag), label = ~as.character(mag))
leaflet(data = dbip[1:20,]) %>%
addTiles() %>%
addMarkers(~LONGITUD, ~LATITUD,
popup = ~as.character(ENTIDAD),
label = ~as.character(ENTIDAD)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment