Create a web page using R Markdown that features a map created with Leaflet.
Host your webpage on either GitHub Pages, RPubs, or NeoCities.
Your webpage must contain the date that you created the document, and it must contain a map created with Leaflet. We would love to see you show off your creativity!
The rubric contains the following two questions:
library(leaflet)
library(readxl)
library(htmltools)
The National Administrative Department of Statistics -DANE- is the entity in charge of producing and communicating official statistical information for Colombia. This work is carried out with all the methodological rigor, and with increasing relevance and opportunity depending on the Colombian socioeconomic reality. The dataset contains the list of the departments and municipalities of Colombia for the year 2019.
The data are available in the link:
setwd("C:/Users/jkram/Desktop/data")
# file.choose()
ruta="C:\\Users\\jkram\\Desktop\\data\\DIVIPOLA_Municipios.xlsx"
excel_sheets(ruta)
## [1] "DIVIPOLA_Municipios"
DataMapCol=read_excel(ruta)
head(DataMapCol,4)
## # A tibble: 4 x 7
## COD_DPTO NOM_DPTO COD_MPIO NOM_MPIO TIPO Latitude Longitude
## <dbl> <chr> <dbl> <chr> <chr> <dbl> <dbl>
## 1 5 ANTIOQUIA 5001 MEDELLÍN Municipio 6.26 -75.6
## 2 5 ANTIOQUIA 5002 ABEJORRAL Municipio 5.80 -75.4
## 3 5 ANTIOQUIA 5004 ABRIAQUÍ Municipio 6.63 -76.1
## 4 5 ANTIOQUIA 5021 ALEJANDRÍA Municipio 6.37 -75.1
map1 <- DataMapCol %>%
leaflet() %>%
addTiles() %>%
addMarkers(clusterOptions = markerClusterOptions(),
popup= ~paste0("<b>","Municipio: ", htmlEscape(NOM_MPIO), "</b>","<br/>",
"<b> Departamento: ", htmlEscape(NOM_DPTO), "</b>")
)
## Assuming "Longitude" and "Latitude" are longitude and latitude, respectively
map1
It is a beautiful travel for Colombia.