Instructions

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!

Initialization

library(leaflet)
library(htmltools)

Data

The data was collected on the following website: https://www.worlds50bestbars.com/list/1-50.

setwd <- getwd()
data <- read.csv(file = "50 best bars.csv", header = TRUE, sep = ";")

Creation of the dataframe

map <- data.frame(Rank = data$Rank,
                  Name = data$Name,
                  City = data$City,
                  Country = data$Country,
                  Latitude = data$Latitude,
                  Longitude = data$Longitude)

Activation of the map

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

Display of the map

map