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 point pattern analysis is no longer part of the teaching session. We also shortened the handling of kriging in the course. Still the content is kept in the course book.

During the summer term 2023 the content was slightly extended by additional figures. Also, interpretation of figures and results was expanded in the text - at least at some locations.

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, A., Rubak, E., Turner, R., 2015. Spatial Point Patterns: Methodology and Applications with R. CRC Press.
Bivand, E.P., Roger, n.d. Spatial Data Science.
Griffith, D., Chun, Y., Li, B., 2019. Spatial Regression Analysis Using Eigenvector Spatial Filtering. Academic Press.
Lovelace, R., Nowosad, J., Muenchow, J., 2019. Geocomputation with R. CRC Press.
Moraga, P., 2019. Geospatial Health Data: Modeling and Visualization with R-INLA and Shiny. CRC Press.
Wickham, H., Grolemund, G., 2016. R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. "O’Reilly Media, Inc.".
Zuur, A.F., Ieno, E.N., Walker, N.J., Saveliev, A.A., Smith, G.M., 2009. Mixed effects models and extensions in ecology with r. Springer Verlag.