Spatial Statistics with R

Published

March 15, 2024

Introduction

Required packages

The following packages may be used during the course; it is assumed that you know how to install packages, and have permission to do so on your computer.

CRAN packages:

install.packages(c("classInt",
"colorspace",
"dplyr",
"ggplot2",
"gstat",
"hglm",
"igraph",
"lme4",
"lwgeom",
"maps" ,
"mapview",
"randomForest",
"rnaturalearth",
"s2",
"scales",
"sf",
"sp",
"spacetime",
"spdep",
"spatialreg",
"spatstat",
"spData",
"stars",
"terra",
"tidyverse",
"tmap",
"units",
"viridis",
"viridisLite",
"xts"))

non-CRAN packages:

install.packages("spDataLarge", repos = "https://nowosad.github.io/drat/", 
                 type = "source")
install.packages("starsdata", repos = "http://cran.uni-muenster.de/pebesma/", 
                 type = "source")

Introduction to the course

  • introduction of the tutor
  • introduction of course participants, please state
    • name,
    • where you’re from,
    • what kind of spatial data analysis you have done so far

How we work

  • live sessions are from 15:00-18:00 CET (Berlin time)
    • 3 blocks of 50 min + 10 mins break
    • please raise hands or speak up whenever something comes up
  • slack communication during the full week
  • please share questions you run into in your actual research, preferably with (example) data and R code
  • please use the open channels in slack, so that everyone can learn from q + a’s

Resources

Why R for spatial statistics?

  • R is old! Think of the advantages!
  • R is as good as any data science language, but is more in focus with the statistical community
  • Most researchers in spatial statistics who share code have used or use R
  • R has a strong ecosystem of users and developers, who communicate and collaborate (and compete, mostly in a good way)
  • R spatial packages have gone full cycle:
    • the first generation has been deprecated
    • removed from CRAN, and
    • replaced by modern versions
  • R is a data science language that allows you to work reproducibly
  • Because we have CRAN and CRAN Taskviews: Spatial, SpatioTemporal, Tracking

Reproducing the current course

  • Go to https://github.com/edzer/sswr/
  • Go to “Code”, “copy URL to clipboard”
  • Clone this repo to your hard drive
  • Start one of the qmd files by double clicking, or on the command line with RStudio, or using some other tooling
  • Run the code sections!