16  Introduction to Maps

In the previous chapters, you were introduced to the basics of "dplyr" and "ggplot2", which we then used to perform various operations on the data storms to obtain a wide array of visualizations as well as derived tables and summary statistics. Because storms contains geographical information such as longitude and latitude, in this part we take a further step to learn about plotting basic, and not so basic, maps with "ggplot2" as well as with some dedicated packages to create maps in R.

16.1 Some Words about Maps in R

For better or worse, there are various approaches to handle geographic data in R, with multiple packages for graphing all sorts of maps, and geospatial information.

I should mention that the ecosystem of R packages to work with spatial data has evolved over more than two decades, and it keeps evolving as I write this.

In recent years, one particular project has played a central role in the way geospatial data R can be handled: the so-called Simple Features project. Simply put, Simple Features is an open-source standard and model to store and access vector geometries. Its corresponding R package is sf.

In the next chapters, I’m going to focus on the packages listed below. Please keep in mind that this list is by no means a comprehensive set of tools for making maps in R. It’s my opinionated list of the tools that I’m most familiar with when working with geographic data sets.

  • maps: classic R package with data sets of maps, and functions for drawing maps.

  • rnaturalearth: package to hold and facilitate interaction with map data from Natural Earth, a public domain map dataset.

  • sf: Simple Features provides classes and functions for vector data.

  • leaflet: for making interactive maps.

  • tmap: Thematic Maps for making static and interactive maps.

16.1.1 A Few Resources on Maps in R

Additionally, here is a short list of good resources to look at are: