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!
##Using required Packages
library("leaflet")
library(htmltools)
##Accessing the data from .csv text file From Kagle: Dataset about the best restaurants in the world. By Megh Mayur. Contains the list of The World’s 50 Best Restaurants for 2018 (https://www.kaggle.com/mmayur/the-worlds-50-best-restaurants)
datamap <- read.csv(file = "TheWorlds50BestRestaurants2018.csv", header = TRUE, sep = ",")
##Creating my data frame in order to manipulate the dataset like a table.
mimapa <- data.frame(Ranking = datamap$Ranking,
Name = datamap$Name,
City = datamap$City,
Country = datamap$Country,
Latitude = datamap$Latitude,
Longitude = datamap$Longitude
)
##Activating the Map
map <- mimapa %>%
leaflet() %>%
addTiles() %>%
addMarkers(popup=paste
("<br>Country: ",
htmlEscape(mimapa$Country),
"<br>City: ",
htmlEscape(mimapa$City),
"<br>Restaurant: ",
htmlEscape(mimapa$Name),
"<br>Ranking: ",
formatC(datamap$Ranking, format = "d", big.mark = ",")
)
)
## Assuming "Longitude" and "Latitude" are longitude and latitude, respectively
map