Please note: These exercises assume you have downloaded the mapping-with-R repository to your local installation of RStudio and are running this as a unique project within RStudio. You can do these exercises in R without the RStudio IDE (or any other IDE). However, you may experience minor differences with relative file locations; translation is assumed to be the responsibility of the student in that case.


  1. Georeference XY coordinates. In your RStudio editor, open the _exercise-1_xy-leaflet.Rmd file from the project root. Plot XY (latitude/longitude) coordinates on a leaflet map.

  2. Choropleths with tidycensus. Open the _exercise-2_tidycensus.Rmd file. Plot a new variable and shade that variable by county.

  3. Simple Features. Open the _exercise-3_thematic-map_with_federal_data.Rmd file. Make a choropleth of the data using either ggplot2, tmap, or leaflet. Use the knowledge you gained in the Simple Features module.


  1. Georeferencing latitude and longitude
  2. Choropleths with tidycensus
R We Having Fun Yet‽ -- Learning Series
Data & Visualization Services
Duke University Libraries
C bn
Shareable via Creative Commons: CC By-NC