Task

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!

Download dataset

library(leaflet)
## Warning: пакет 'leaflet' был собран под R версии 4.4.1
library(readr)
library(htmltools)

worldcitiespop <- read_csv("worldcitiespop.csv", show_col_types = FALSE)[c(1, 500, 10542, 658745, 1564965),]

my_map <- data.frame(
                     City = worldcitiespop$City,
                     Country = worldcitiespop$Country,
                     Latitude = worldcitiespop$Latitude,
                     Longitude = worldcitiespop$Longitude
                     )

Create map

map <- my_map %>%
  leaflet() %>%
  addTiles() %>%
  addMarkers(popup=paste
             ("<br>Country: ", 
               htmlEscape(my_map$Country), 
              "<br>City: ", 
               htmlEscape(my_map$City), 
              "<br>Restaurant: ", 
               htmlEscape(my_map$Name)
              ) 
            )
## Assuming "Longitude" and "Latitude" are longitude and latitude, respectively

Activating the map

map