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!
library(leaflet)
library(htmltools)
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 = ";")
map <- data.frame(Rank = data$Rank,
Name = data$Name,
City = data$City,
Country = data$Country,
Latitude = data$Latitude,
Longitude = data$Longitude)
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
map