An introduction to road safety analysis with R

Pre-requisites

If you are not experienced with R, it is strongly advised that you read-up on and more importantly test out R and RStudio before attempting analyse road crash data with R. See the stats19-training-setup vignette at https://docs.ropensci.org/stats19/articles/stats19-training-setup.html for guidance on getting started with R, RStudio and installing R packages.

The core packages we will be using in this tutorial are as follows:

pkgs = c(
  "sf",          # spatial data package
  "stats19",     # downloads and formats open stats19 crash data
  "dplyr",       # a package data manipulation, part of the tidyverse
  "tmap"         # for making maps
)
#> Warning in citation(pkg, auto = if (pkg == "base") NULL else TRUE): no date
#> field in DESCRIPTION file of package 'sf'
#> Warning in citation(pkg, auto = if (pkg == "base") NULL else TRUE): no date
#> field in DESCRIPTION file of package 'stats19'
#> Warning in citation(pkg, auto = if (pkg == "base") NULL else TRUE): could
#> not determine year for 'stats19' from package DESCRIPTION file
remotes::install_cran(pkgs)
# remotes::install_github("ITSLeeds/pct")

Introduction

This vignette supports workshops on road safety analysis with R. It was initially developed for a 2 day Introduction to R for Road Safety course funded by the RAC Foundation, a charity that supports road safety research.

The course is based on open access road crash data from the UK, which is provided in an accessible form to R users through the R package stats19 (Lovelace et al. 2019). However, the content should be of use for anyone working with road crash data that has (at a minimum):

Agenda

The preliminary agenda is as follows:

Day 1: An introduction to R and RStudio for spatial and temporal data

09:00-09:30 Arrival and set-up

09:30-11:00 Introduction to the course and software

Break

11:15-12:30 Working with temporal data

Lunch

13:30-15:00 Working with spatial data

Break

15:15-15:30 Talk on Road Safety 1

15:30-16:15 Practical - Applying the methods to stats19 data - a taster

16:15-16:30 Talk on Road Safety 2

Day 2 road safety analysis with R

09:30-11:00 Point pattern analysis

11:15-12:30 Road network data

Lunch

13:30-15:00 Analysing crash data on road network

Break

15:15-15:30: Talk on Road Safety 3

15:30-16:30 Applying the methods to your own data

References

Lovelace, Robin, Malcolm Morgan, Layik Hama, Mark Padgham, and M Padgham. 2019. “Stats19 A Package for Working with Open Road Crash Data.” Journal of Open Source Software 4 (33): 1181. doi:10.21105/joss.01181.