1. Learn
  2. /
  3. Courses
  4. /
  5. Interactive Maps with leaflet in R

Connected

Exercise

Building a Base

Now that we know where to center our map (Lat = 39.8282, Lng = -98.5795), let's build a new basemap. Remember that we can use either addTiles() or addProviderTiles() to add a map tile to our leaflet object.

Since we are working toward mapping all of America's colleges, we can include the ipeds data at the start of the chain of functions that will create our base map. This way the ipeds data will be stored with our base map so that we can easily access it. Once we have built a solid base, we can map every college in America with just two lines of R code.

The ipeds data and leaflet and tidyverse libraries have been loaded for you.

Instructions

100 XP
  • Store a new map in the m2 object that:
    • Uses the CartoDB provider tile.
    • Has a zoom level of 3.
    • Then add circle markers to m2 to map all of America's colleges.