2 Prerequisites

2.1 R Prerequisites

The overwhelming majority of mapping projects in this tome require a working R7 installation. For most folks, I highly recommend that you use RStudio8 as your editor/IDE. I used R 3.6.x versions and generally work with RStudio 1.3.x dailies. You should be able to use R 3.5.x and RStudio 1.2.x.

2.1.1 R Packages

The {sf} and {raster} packages are used heavily in most of the R projects along with a larger number of CRAN packages than I realized as I was working through each day’s challenge:

install.packages(c(
  "sf", "raster", "geofacet", "ggwordcloud", "googlesheets", "grid", 
  "gridExtra", "httr", "magick", "magrittr", "mapdeck", "patchwork", 
  "pdftools", "rasterVis", "readxl", "rnaturalearth", "rvest", 
  "stringi", "threejs", "tidyverse", "tigris", "tweenr", "zipcode"
))

You’ll also want to install.packages(c("devtools", "remotes")) since I also rely on a few of my own “development versions” of packages. You should read up on {devtools}9 since you may need to install Rtools10.

Once you have {devtools} and {remotes} loaded up, you can install the other dependencies via:

remotes::install_github("hrbrmstr/asam")
remotes::install_github("hrbrmstr/albersusa")
remotes::install_github("hrbrmstr/curlconverter")
remotes::install_github("hrbrmstr/hrbrthemes")
remotes::install_github("hrbrmstr/rgeocodio")
remotes::install_github("hrbrmstr/terminator")
remotes::install_github("hrbrmstr/widgetcard")

You’ll need to do some further legwork since {rgeocodio} requires a <geocod.io> API key and {mapdeck} will also require a MapBox API key. I’ve provided data files for most things, so the {rgeocodio} API key may not be 100% necessary.

If you don’t have the CRAN and/or dev-mode packages already installed you should be prepared to have this take a while, especially if you have to figure out how to get underlying libraries installed to get things to work.

2.2 Non-R Prerequisites

One (the only) non-R tool is the utility that generatres the IPv4 heatmap. Said tool is unsurprisingly named ipv4-heatmap11. It compiles fine on Linux and macOS, but I’ve never tried to work with it on Windows. You can likely skip that day’s challenge if using this on Windows proves more problematic than you have time for.

2.3 Data Prerequisites

I used quite a bit of data from online resources and many of the files are quite large. You’ll need sufficient bandwidth and storage to download them all. I’ve whittled most of them down and included them in the repository for the challenges, but it might be worth the effort to go through the acquisition process, especially since I’ll also be documenting how I looked for the data I ended up using.

2.4 Required Reading

Geocomputation with R by Robin Lovelace, Jakub Nowosad, and Jannes Muenchow12, 13 is a must-have resource for getting started with spatial operations in R.