Do you have some data with geolocation information that you want to map? You may not think of R when you're looking for a GIS platform, but new packages and standards have helped make the R programming language a surprisingly robust platform for some geospatial analysis.
These examples will demonstrate how to map election results, but the concepts can easily be used for any other kind of color-coded choropleth map. I'll show how to handle a straightforward two-person race and a more complex race with three or more candidates.
We'll be using two mapping packages in this tutorial: tmap and tmaptools for quick static maps and leaflet for interactive maps. You can install and load them now with