Read dataset

library(leaflet)
library(lubridate)

today <- Sys.Date()
month <- lubridate::dmonths(2)
date_ <- date(today-month)
data<- read.csv("../Departamentos_coordenadas.csv")

Read Image for make icon

icono <- makeIcon(
  iconUrl = c(
    "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/Flag_of_Santa_Cruz.svg/120px-Flag_of_Santa_Cruz.svg.png",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f0/Flag_of_Cochabamba.svg/120px-Flag_of_Cochabamba.svg.png",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/1/12/Bandera_de_La_Paz.svg/120px-Bandera_de_La_Paz.svg.png",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/9/97/Bandera_de_Sucre_y_Chuquisaca.png/120px-Bandera_de_Sucre_y_Chuquisaca.png",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/0/06/Flag_of_Oruro.svg/120px-Flag_of_Oruro.svg.png",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Flag_of_Tarija.svg/120px-Flag_of_Tarija.svg.png",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Flag_of_Potos%C3%AD.svg/120px-Flag_of_Potos%C3%AD.svg.png",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a1/Flag_of_Trinidad_-_Bolivia.svg/120px-Flag_of_Trinidad_-_Bolivia.svg.png",
    "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9f/Flag_of_Pando.svg/120px-Flag_of_Pando.svg.png"),
  iconWidth =31*215/230 ,iconHeight = 31,
  iconAnchorX =31*215/230/2 , iconAnchorY =16 )

Website for more information

2020-12-12

sitio_web <- "<a href = 'https://es.wikipedia.org/wiki/Bolivia'> Bolivia Wikipedia</a>"

Map

I made a map of the country of Bolivia with its 9 cities and their flags, I also added the colors of the Bolivian flag as a legend.

data  %>% 
  leaflet() %>%
  addTiles() %>%
  addMarkers(icon = icono, popup = sitio_web, lat = data$lat ,lng = data$lng ) %>% 
  addLegend( labels = c( "red" , "yellow" , "green"), 
           colors = c( "red" , "yellow" , "green") )