1. Introduction:

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.

  1. United Nations Headquarters: Latitude = 40.7489, Longitude = -73.9680
  2. Times Square: Latitude = 40.7580, Longitude = -73.9855
  3. Empire State Building: Latitude = 40.7484, Longitude = -73.9857
  4. Rockfeller Center: Latitude = 40.7587, Longitude = -73.978 7

2. Making a Leaflet Interactive Plot with Popups:

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)