R for Spatial Statistics



Note that the spatial part of this web site starts in section 5. This is because we need to have some background in using R before getting into spatial statistics. Jumping ahead is okay, just be ready to go back a bit if you don't recognize something right away.

1. Getting Started

The first lessons below will introduce you to using R. These lessons are not focused on spatial data but on the basic operations of R you'll need for working with Spatial Data.

  1. About R
  2. Installing
  3. Introduction To R and R Studio
  4. Getting Started with R
  5. Writing Scripts
  6. Getting Help

2. Exploring Tabular Data

These lessons will show you how to create data in R and use R to explore data.

  1. Generating Data
  2. Filtering Datatables
  3. Linear Regression
  4. Histograms
  5. Testing Normality (QQPlots)
  6. Testing for Covariance
  7. 2D Plots
  8. Files and Folders
  9. 3D Plots
  10. Combined Model Plot

3. Control Flow

  1. Boolean values, comparisons and "if" statements
  2. Looping
  3. Functions

4. Packages and Libraries

  1. Packages and Libraries

5. Working With Spatial Data

The packages for spatial data are rather complex and in a state of transition from older ones to newer ones. I recommend checking out this web page before continuing. The pages below start with approaches that use CSV files with points and then get into the most reliable packages I have found.

  1. Introduction
  2. Point Data (CSVs) as Data Frames
  3. Reading Raster File Formats (and other raster operations)
    1. Note that rgdal (rgdal is going away in 2023)
  4. Working with Vector Data in sf
  5. Converting columns
  6. Cluster Analysis

6. Interpolation

  1. Interpolation
  2. Variograms & Kriging
  3. Spatial Statistics (incomplete)

7. Correlation/Regression Models

  1. Generalized Linear Models (GLMs)
  2. Generalized Additive Models (GAMs)
  3. Categorical and Regression Trees (CART)
  4. Habitat Suitability Models
  5. Presence-Only Example with GAMs

8. Monte Carlo Methods

  1. Introduction to Monte Carlo methods
  2. Sub-Sampling Data for Cross-Validation
  3. Noise Injection
  4. Estimating Uncertainty in Raster Covariates
  5. Creating Uncertianty Maps

9. Additional Information

  1. Tips
  2. Applied Spatial Analysis with R
  3. R as a GIS


The material in this web site was drawn from a large number of web sites, blogs, articles, and books. Special thanks go to Jose Montero for contributing content.