In this document we will make an interactive map in R using the leaflet package. We will plot the location of the following places on an interactive map.
library(leaflet)
df <- data.frame(lat = c(40.7489, 40.7580, 40.7484, 40.7587),
lng = c(-73.9680, -73.9855, -73.9857, -73.9787),
popup = c('United Nations Headquarters',
'Times Square',
'Empire State Building',
'Rockfeller Center'))
df %>%
leaflet() %>%
addTiles() %>%
addMarkers(popup = df$popup)