This lecture provided an introduction to working with geographic data using R in a ‘tidy’ way. It focused on using the sf package to read, write, manipulate, and plot geographic data in combination with the tidyverse metapackage. Why use the sf package with the tidyverse? The lecture outlined some of the ideas underlying the tidyverse and how they can speed-up data analysis pipelines, while making data analysis code easier to read and write. We saw how the following lines library(sf) / library(tidyverse) can provide a foundation on which the many geographic data analysis problems can be solved. The lecture also covered on more recently developed packages that integrate with the tidyverse to a greater and lesser extent. We looked at how the geos package, which provides a simple and high-performance interface to the GEOS library for performing geometric operations on geographic data, integrates with the tidyverse. The tidyverse is not the right tool for every data analysis task and we touched on alternatives for working with raster data, with reference to the terra package, and alternative frameworks such as data.table. Finally, we also looked at how the ‘tidy’ philosophy could be implemented in other programming languages, such as Python.
The focus throughout was on practical skills and using packages effectively within the wider context of project management tools, integrated development environments (we recommend VS Code with appropriate extensions or RStudio), and version control systems. |