Introduction

This workshop aims to provide the very basics of R to newcomers and a first introduction to spatial data handling in R using the R-spatial ecosystem. We will also present to the audience mapping with the {tmap} package, vector data handling with {sf} and raster data handling with {terra}.

No previous knowledge of R is required.

The workshop leaders are Nicolas Roelandt from Gustave Eiffel university (Lyon, France) and Jakub Nowosad from Adam Mickiewicz University (Poznań, Poland).

Gustave Eiffel university and Adam Mickiewicz University, Poznań logos

Schedule

  • Opening the workshop (5 min)
  • Introduction to R (15 min)
  • Non-spatial data handling (30 min)
  • Introduction to the R-spatial ecosystem (20 min)
  • Mapping in R with {tmap} (30 min)
  • Coffee break (20 min)
  • Vector data processing (45 min)
  • Raster data processing (45 min)
  • Closing the workshop (5 min)

Pre-requisites

  1. A working installation of R (following CRAN recommandations for your computer)

R comes with the RGui interface. It is usable but for a better user experience we recommend using Rstudio.

Jupyter Notebook with the IRKernel can also be a good option.

  1. R packages

Please run those commands into the R console:

# Install remote package from CRAN Repo
install.packages(remotes)

# Install workshop and its dependencies
remotes::install_github("Bakaniko/foss4g2022-getting-started-rspatial")

What is love R ?

R is a programming language dedicated to data science. It can compute statistics and produce graphics and reports (and much more).

It was created by Ross Ihaka and Robert Gentleman in 1993 and was released as a Free and Open Source Software in 1995.

Why an R workshop in a FOSS4G conference ?

While R is not dedicated to spatial analysis, there a several dozen of packages that provides geospatial capabilities to the language.

  • Use R as a standalone GIS:
    • read and write geospatial data
    • connect to geospatial databases
    • perform spatial analysis
    • make geostatistical modelling, prediction and simulation
    • access to algorithms from other tools (QGIS, GRASS, SAGA)
  • Use R in other FOSS4G tools:

Coding paradigms

When R was released, there was no strong syntax philosophy, so there are some inconsistencies in packages, functions, and arguments naming, for example. R base readability and performance were not good enough for some users, so they developed packages to improve those.

When using R for data analysis, you will encounter three majors coding paradigms:

Base R is a vanilla R code. The tidyverse aims to provide a more consistent grammar and readability. data.table provides a fast and powerful alternative to R base with consistent grammar.

You can mix those paradigms for your projects, but for teaching purposes, the workshop materials will use tidyverse with some base R.