library(leaflet) #Overview #This webpage features an interactive map built with Leaflet in R Markdown, satisfying the course requirements for reproducible data products.
#The map highlights several prominent UNESCO World Heritage Sites around the world. Click on any marker to learn more or zoom out to view clustered sites.
#Interactive Map # Define data frame of locations heritage_sites <- data.frame( name = c( “Taj Mahal (India)”, “Machu Picchu (Peru)”, “Colosseum (Italy)”, “Great Wall (China)”, “Christ the Redeemer (Brazil)”, “Petra (Jordan)” ), lat = c(27.1751, -13.1631, 41.8902, 40.4319, -22.9519, 30.3285), lng = c(78.0421, -72.5450, 12.4922, 116.5704, -43.2105, 35.4444) )
heritage_sites %>% leaflet() %>% addTiles() %>% addMarkers( lng = ~lng, lat = ~lat, popup = ~name, clusterOptions = markerClusterOptions() ) # 1. Create coordinates and labels sites <- data.frame( name = c(“Location A”, “Location B”), lat = c(28.6139, 12.9716), lng = c(77.2090, 77.5946) )
my_map <- leaflet(sites) %>% addTiles() %>% addMarkers(lng = ~lng, lat = ~lat, popup = ~name)
my_map