Using Spatial Data with R
Last updated: February 11, 2019
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.
Create a new RStudio project
R-spatialin a new folder
Create a new folder under
R-spatialand call it
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.
Open up a new R Script file
R-spatial.Rfor the code you’ll create during the workshop.
- Install and load the following libraries:
- For the mapping section install and load these additional libraries:
Bivand, RS., Pebesma, E., Gómez-Rubio, V. (2013): Applied Spatial Data Analysis with R
Brunsdon, C. and Comber, L. (2015): An Introduction to R for Spatial Analysis and Mapping
Lovelace, R., Nowosad, J., Muenchow. J. (2019): Geocomputation with R
Engel, C. (2019). R for Geospatial Analysis and Mapping. The Geographic Information Science & Technology Body of Knowledge (1st Quarter 2019 Edition), John P. Wilson (Ed.). DOI:10.22224/gistbok/2019.1.3.
For a quick introduction to all things geo check out map school.
Some of the materials for this tutorial are adapted from http://datacarpentry.org