Skip to content

R for Highways Research and Transport Planning - course materials

License

Notifications You must be signed in to change notification settings

eyesofbambi/highways-course

 
 

Repository files navigation

Aim

The aim of R for Highways Research and Transport Planning is to teach how R can be used as a powerful tool for processing, visualising and modelling transport data.

Course contents can be found online at: https://github.com/ITSLeeds/highways-course

Location

Leeds Institute for Transport Studies, 40 University Road, LS2 9JT. It can be seen in this web map, highlighted in red below, just opposite Woodhouse Moore (it’s a 20 minute walk from the station):

Course contents

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

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

  • Introduction to R
  • R installation questions/debugging
  • How to use RStudio (practical in groups of 2)
  • R classes and working with data frames (CC)

11:15-12:30 Statistics and packages

  • Stats refresher: plots and descriptive statistics
  • Predictive models
  • Using packages: examples with the tidyverse

Lunch

13:30-15:00 Spatial data in R

15:15-16:30 Real-work example and consolidation

Day 2 transport data

09:30-11:00 An introduction to point (Stats19) data

  • Point data: Stats19
  • Spatial and temporal subsetting
  • Aggregation

11:15-12:30 Desire lines and routing

  • Desire lines: using origin-destination data
  • Routing
  • Bonus: finding crash hotspots

Lunch

13:30-15:00 Road traffic data

  • Traffic data introduction (Josh Manning)
  • Temporal analysis
  • Spatial analysis

15:15-16:30 Practical application

  • Working on real datasets such as flooding or traffic data, or improving specific skills such as visualisation

Prerequisites

Prior reading/experience

If you are new to R, ensure you have attempted a basic introductory course such as DataCamp’s introduction to R free course or equivalent.

If you’re interested in R for ‘data science’ and installing/updating/choosing R packages, these additional resources are recommended (these optional resources are all freely availble online):

Computing requirements

Attendees are expected to bring their own laptop with the following packages installed and working. You can check these are all installed, and install those that are not installed, as follows (you can also just type install.packages("sf") etc):

install.packages("osmdata")   # for working with open street map data
install.packages("sf")        # a package for working with spatial data
install.packages("spData")    # provides example data
install.packages("stplanr")   # a transport data package
install.packages("tidyverse") # metapackage for data science
install.packages("tmap")      # a mapping package

# Make sure your packages are up-to-date with:
update.packages()

In addition, it would be useful to have oneminutetraffic, which can be installed with:

devtools::install_github("RACFoundation/oneminutetrafficdata")

Reproducible example

The code in the following example checks you have the necessary packages installed. It results in a map that will guide you to the location of the course.

Attach the packages:

library(sf)
library(stplanr)
library(tidyverse)

The overall route assuming you’re travelling from London:

uk = spData::world %>% 
  filter(name_long == "United Kingdom")
origin_lnd = c(-0.1, 51.5)
destination = c(-1.55, 53.8)
odmatrix = matrix(c(origin_lnd, destination), ncol = 2, byrow = TRUE)
line_lnd = st_linestring(odmatrix) %>% 
  st_sfc() %>% 
  st_sf(crs = 4326)
plot(st_geometry(uk), col = "grey")
plot(line_lnd, add = TRUE, lwd = 5, col = "red")

About

R for Highways Research and Transport Planning - course materials

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TeX 100.0%