Using Spatial Data with R
Last updated: February 21, 2024
Prerequisites and Preparations
To get the most out of this workshop you should have:
- a basic knowledge of R and/or be familiar with the topics covered in the Introduction to R.
- have a recent version of R and RStudio installed.
Recommended:
- Create a new RStudio project - R-spatialin a new folder- R-spatial.
- Create a new folder under - R-spatialand call it- data.
- Open up a new R Script file and call it - R-spatial.Rfor the code you’ll create during the workshop.
- If you have your working directory set to - R-spatialwhich contains a folder called- datayou can copy, paste, and run the following lines in R:
download.file("http://bit.ly/R-spatial-data", "R-spatial-data.zip")
unzip("R-spatial-data.zip", exdir = "data")You can also download the data manually here R-spatial-data.zip and extract them in the data folder.
- Install and load the following libraries:
- For the mapping section install and load these additional libraries:
- classInt
- RColorBrewer
- ggplot2
- tmap
- leaflet(On Mac installing binary version is ok)
 
References
Lovelace, R., Nowosad, J., Muenchow. J. (2024): Geocomputation with R
Pebesma, E. Bivand, R. (2023): Spatial Data Science
Gimond, M (2023): Intro to GIS and Spatial Analysis
Acknowledgements
Some of the materials for this tutorial are adapted from http://datacarpentry.org