ReproducibleResearch

Reproducible Research in R

This repository provides the materials for a reproducible lecture on reproducibility using R and RStudio. Those include the lecture slides prepared using IOSlides, as well as the instructions and an example of a simple reproducible analysis for a practical session prepared in RMarkdown.

These materials are part of my teaching for the MSc in GIScience at the University of Leicester. Check out my personal website and the Pete Fisher Unit for GIScience of the School of Geography, Geology and the Environment for more information about our research. You can also find me on Twitter @maps4thought and check out @LeicesterGeog for more information on our geography teaching.

Check out the lecture slides first and then read the instructions for the practical session. If you are simply interested in reproducing this project, see the instructions below.

Reference book: Christopher Gandrud, Reproducible Research with R and R Studio also available on GitHub

Tools

This project is based on the R programming language and the RStudio integrated development environment (IDE). The first is necessary, the second is strongly recommended. Both are free, open source, and available for Microsoft Windows, Linux, and Mac OS.

In order to compile the RMarkdown scripts to .pdf documents, RMarkdown requires a LaTeX compiler. If you are working on the University of Leicester Windows 10 computers, please check that MiKTeX is installed in the Software Centre. If not close RStudio if open and install it (this might take a few minutes). Once the installation is completed, re-open RStudio. MiKTeX should work fine for any other Windows system. Make sure to select “Always install missing packages on-the-fly” in the general settings of the MiKTex console, so that the appropriate packages are installed when the .pdf document is compiled. On Linux, please install a TeX distribution, e.g. sudo apt-get install texlive-full on Ubuntu. On Mac OS, please install a TeX distribution such as MacTeX.

In RStudio, select Tools > Global Options…. In the Swave section, make sure that the following options are selected.

Libraries

The project is based on the Tidyverse libraries. Please install Tidyverse before cloning the repository.

install.packages("tidyverse")

Data

The scripts in this project retrieve data from Ofcom and the Department for Transport on 24 October 2018, and released under the Open Government Licence in the United Kingdom. A copy of those data files is provided in the Backup folder. Please see the Open Government License v3 on the National Archives website or the LICENSE file in this folder for.

Build

To build all the scripts in the repository in the correct order, please execute the Make.R script that you can find in the main folder.

source('Make.R')