Data Management in R: A Guide for Social Scientists

Elff, Martin. 2020. Data Management with R: A Guide for Social Scientists. London: SAGE Publications.


This page provides material to accompany my recent book Data Management in R: A Guide for Social Scientists, which is being published by Sage Publications. The material is organised into different pages each corresponding to a chapter of the book:

The material is organised in in the same manner as the chapters and sections of the book. The code examples in each section are contained in a single webpage, where each code example is followed by the output it would produce in the R console or in a graphics window. The code examples for each section are collected into an R script and an RMarkdown file, both of which are available for download from the respective webpage.

Code examples are accompanied by Jupyter notebooks from which the code example pages were created.1 Links to interactive versions of the notebooks are also provided, marked by a Jupyterhub icon, i.e. JupyterHub . There are interactive versions each, one that runs on in a docker container2 for a maximum time of 5 minutes and another one that runs on in a docker container for up to an hour, but requires sign in with an ORCID id.3

The sources of the R-scripts and notebooks (as well as R-markdown files), are also available in the GitHub repository A ZIP-file with the contents of the repository can be downloaded from The Jupyter notebooks come with NO WARRANTY whatsoever. They are provided for educational and illustrative purposes only. Do not use them for production work.


For more information about Jupyter see The Jupyter notebooks make use of the RKernel package.


For more information about Docker see The container images are run with Jupyterhub DockerSpawner.


ORCID is a free service for the authentication of researchers. It also allows to showcase publications and contributions to the academic community such as peer review.. See for more information.