Chapter 1 Preface

This book is the main learning resource for the course “Spatial data science” at the University of Heidelberg, Geographisches Institut, in the summer term 2023. Lecturers of the course are Prof. Sven Lautenbach and Marcel Reinmuth. The course was designed in summer term 2022 and adjusted in 2023. Thereby, the content was shortened. Specifically kriging and point pattern analysis are no longer part of the teaching session. Still the content is kept in the course book.

1.1 Supporting literature

A number of books use R for spatial data analysis and spatial statistics. These resources help to get deeper insights into the topic of the course. The list might be extended during the time of the course.

Books (online)

Books (offline)

1.2 Setting up R & RStudio

R is the programming language. Rstudio is an Integrated Development Interface.

To install R and RStudio choose the installation file that matches your operating system in the links below. Make sure to first install R and Rstudio afterwards. For Rstudio use the free version.

1.3 R libraries for spatial data science

When your R and Rstudio installation is up and running, copy the following chunk to your R console and execute it. The code will check if you have already installed some of the necessary libraries. If not, they will be installed through CRAN. The code checks if the libraries are already installed and installs only missing libraries. Watch for error messages during the installation - sometimes other (external) libraries are missing that might need to be installed separately. Typically the installation should run smooth without problems.

packages <- c("knitr", "tidyverse", "dplyr", "ggplot2", "sf", "s2", "raster", "terra", 
              "stars", "tmap", "gstat", "spdep", "spatialreg", "spatstat", "foreign", 
              "ncf",  "spgwr", "tripack", "GGally", "corrplot")
install.packages(setdiff(packages, rownames(installed.packages())))


Baddeley, Adrian, Ege Rubak, and Rolf Turner. 2015. Spatial Point Patterns: Methodology and Applications with R. CRC Press.
Bivand, Edzer Pebesma, Roger. n.d. Spatial Data Science. Accessed January 21, 2022.
Griffith, Daniel, Yongwan Chun, and Bin Li. 2019. Spatial Regression Analysis Using Eigenvector Spatial Filtering. Academic Press.
Lovelace, Robin, Jakub Nowosad, and Jannes Muenchow. 2019. Geocomputation with R. CRC Press.
Moraga, Paula. 2019. Geospatial Health Data: Modeling and Visualization with R-INLA and Shiny. CRC Press.
Wickham, Hadley, and Garrett Grolemund. 2016. R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. "O’Reilly Media, Inc.".
Zuur, A. F., E. N. Ieno, N. J. Walker, A. A. Saveliev, and G. M. Smith. 2009. Mixed Effects Models and Extensions in Ecology with r. Springer Verlag.