GIS in R

R has a full library of tools for working with spatial data. This includes tools for both vector and raster data, as well as interfacing with data from other sources (like ArcGIS) and making maps.

These tutorials — which build off Claudia Engel’s excellent GIS in R tutorials — are designed for users with some familiarity with R, but require no knowledge of spatial analysis. If you aren’t used to working with R, you will probably want to spend some little time familiarizing yourself with the language before starting this series. (Here’s a good set of R tutorials if you need them)

Each tutorial is divided into several parts (to be done in sequence), and include a zipped folder of data for exercises.  In addition, cheatsheets are provided which may be of help in remembering the various commands you will frequently use. Each tutorial is meant to take ~1.5 hours, not including software installation.

These tutorials have a share-and-share-alike Creative Commons license, so please feel free to use and modify as you see fit. You can find rmarkdown source files on github here.

Command Cheatsheets:

Learning GIS in R involves learning both concepts and vocabulary. Here are some cheatsheets to help with the later.

 

Tutorial 1: Introduction to Data Types

The aim of Tutorial 1 is to provide users with a solid understanding of how R things about spatial data. It covers some material that users will not need to deal with on a day to day basis, but by providing an understanding of the organization of each library, it is my hope they will help users avoid problems, solve problems when they arise, and to know how to identify the sources of problems when they need to ask others for guidance.

Data for Tutorial 1

 

Tutorial 2: Combining Multiple Data Sources

Rarely can the answers we seek be found in a single data-set. Here are a set of tools for combining multiple datasets through methods like spatial joins, distance calculations, etc.

Data for Tutorial 2

 

Tutorial 3: Making Maps

Visualization is central to sharing our results. This tutorial covers the basics of making visually appealing and informative maps in R.

Data for Tutorial 3

Tutorial 4: Geocoding (Very Short) and Background on APIs

How to convert addresses and location names to latitudes and longitudes from R using the Google Maps API. Also some optional background on what an API is, and how most web APIs work.

Data for Tutorial 4

 

Tutorial 5: Spatial Statistics and Surface Interpolation

Libraries for spatial statistics like Ripley’s K, Moran’s I, Spatial Auto-Regressive  Lag regressions, Error Auto-Regressive regressions, etc, as well as libraries for surface interpolation via IDW and Kriging.

Data for Tutorial 5

Tutorial 6: Combining Network Analysis with GIS

This tutorial introduces network analysis concepts, and provides an overview of how to combine a specific type of network analysis — community detection — with GIS to visualize community structures in space.

Data for Tutorial 6

Tutorial 7: Need more performance?

A brief overview of some tools for getting better performance. For example, tutorial includes an example of how to find the nearest neighbor in one DataFrame for each observation in a second DataFrame without calculating every single distance and taking the minimum.

Other Resources by Other People:

 

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.