This online walkthrough and material accompanies a two hour “show-and-tell” workshop on making thematic (historical) maps with R.

The worked example uses historical 1851 census-data from The occupational structure of Britain 1379-1911-project to demonstrate how to load, explore and plot spatial data, with a focus on showing how spatial data can be integrated in an “regular” R tidyverse data-analysis workflow.

The walkthrough demonstrate how to make static maps using the R library tmap, and interactive maps for data-exploration using the mapview library.

The intended audience are basic R users – or those interested in seeing what R can do – who wish integrate spatial data into their “regular” (exploratory) data-analysis workflow. More advanced GIS-topics such as projection fall outside of the scope.

The material and examples are structured along the four basic steps you generally take when making thematic maps:

1. Introduction and motivating examples of static and interactive thematic maps.
4. Jointly manipulate your spatial and “regular” data.
5. Finally, plot and tweak your map.

I like hearing from you if this walkthrough and/or has been useful somehow, if something is not working or can be improved, or if you are interested in a workshop.

You can copy-past the code snippets from these online pages, download the entire set of material, or clone from Github.

Opening the file historical-maps-r.Rproj in the downloaded folder launches an Rstudio-project, after which you should be able to open, adapt, and run the Rmarkdown notebooks containing the examples (files ending in .Rmd).

# Setup

3. Run commands below to install required R-packages.
install.packages('rmarkdown')
install.packages('tidyr')
install.packages('here')
install.packages('sf')
install.packages('tmap')
install.packages('dplyr')
install.packages('scales')