Session Ready
Exercise

Making our Map Pop

Similar to building a plot with ggplot2 or manipulating data with dplyr, your map needs to be stored in an object if you reference it later in your code.

Speaking of dplyr, the %>% operator can pipe data into the function chain that creates a leaflet map.

ipeds %>% 
    leaflet()  %>% 
        addTiles() %>% 
        addCircleMarkers(popup = ~name, color = "#FF0000")


Piping makes our code more readable and allows us to refer to variables using the ~ operator rather than repeatedly specifying the data frame.

The color argument in addCircleMarkers() takes the name of a color or a hex code. For example, red or #FF0000.

map has been printed for you. Notice the circle markers are gone!

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Add circle markers with popups for college names.