Robin Lovelace

Recently Published

Thurso merged networks
Alder Hey RNET demo
Merged net 2023-09
Edinburgh rnets2
Edinburgh rnets
Schools in Manchester 2
Schools in Manchester
rnet_join() example
#' @examples #' library(sf) #' library(dplyr) #' # Uncomment for interactive examples: #' # library(mapview) #' plot(route_network_small["flow"]) #' plot(osm_net_example$geometry, lwd = 5, col = "grey") #' plot(route_network_small["flow"], add = TRUE) #' rnetj = rnet_join(osm_net_example, route_network_small, dist = 9) #' mapview(rnetj, zcol = "flow") + #' mapview(route_network_small, zcol = "flow") #' plot(rnetj["flow"]) #' plot(route_network_small["flow"], add = TRUE) #' rnetj_summary = rnetj %>% #' sf::st_drop_geometry() %>% #' group_by(osm_id) %>% #' summarise( #' flow = weighted.mean(flow, length_y, na.rm = TRUE), #' ) #' osm_joined_rnet = left_join(osm_net_example, rnetj_summary) #' plot(osm_joined_rnet[c("flow", "highway")]) #' mapview(joined_network) + #' mapview(route_network_small)
Targets workflow
Intro to R 2022
NCN demo
Testing county stats
Interactive distance decay plot
SP Baseline
SP Curto
SP Dutch
SP Ebike
SP Ebike scenario test
Demo SIM jittered, Kildare
SI tests + zones
SIM test no-jittering
Prototype SI model
Pubs data Kildare
NJ Ebikes
Combined rnet results NJ
NJ Baseline
gl test 1
Colour tests
Test map - leeds infra
Baseline cycle network in SP
Edinburgh zones
PCT Training Updated
Getting and using data from the PCT
Marked-up version of
LTNs in Leeds
Animated map - mapdeck example
Slopes demo
Cycle thefts amenities
Active travel potential and planning
Slides for SSPA module at ITS Leeds
Heatmap 10m III
Heatmap 10m II
Heatmap 10m
Heat map of cycling potential
Isle of Wight maps
Walking and cycling levels in Chorlton, Manchester
From the 2011 Census via the PCT
Ebikes Trondheim
Spare space in Santiago
Spare lanes in Chiles
Bicycle tag use in Norway
Wormhole zones
Cycle network Edinburgh
Cycling potential in UK cities
OSM Cycleways NJ
Testing tabset feature in RMarkdown
Supermarkets GB
Luton cycle infra
Luton cycleways - 2019
Clustering route networks - Leeds
See here for code:
Routing example
Test results for Cambridge
Roads Cambridge
Hilliness - top routes Lisbon
Coursework update
For sspa module
mapview basic plot
Woodland-park-scheme leeds
Routing tests
Bedford rail routes
Bedford busyness
Holiday plan in Slovenia
Historic map of Hereford MKII
historic map - hereford
From 1910 - 1915 land use survey
Parks in north Leeds II
Chaco pv estimates
Parks in north Leeds
Cyclability and Route Analysis
NZ demo map
LIDA location - interactive
See here:
3d map - mapdeck
For biodar project
Demo multiple raster layers
Accessibility slides
For sspa module
Desire lines to Bradford
Car dependent desire lines in Greater Manchester
Code: u = "" # u = "/mnt/27bfad9a-3474-4e61-9a43-0156ebc67d67/home/robin/npct/pct-outputs-regional-R/commute/msoa/greater-manchester/l.Rds" # desire_lines = readRDS(u) # desire_lines = sf::st_as_sf(desire_lines) library(dplyr) library(sf) desire_lines_all = read_sf(u) plot(desire_lines_all$geometry) plot(cw, add = T, col = "green") desire_lines_1000 = desire_lines %>% top_n(1000, all) car_dependent_routes = desire_lines_1000 %>% mutate(percent_drive = car_driver / all * 100) %>% filter(rf_dist_km < 3 & rf_dist_km > 1)
Car dependence in Leeds
library(sf) library(tidyverse) desire_lines = read_sf("") plot(desire_lines) car_dependent = desire_lines %>% filter(car_driver / all > 0.5 & rf_dist_km < 3) mapview::mapview(car_dependent)
test- mapview
Cycling-society presentation
Lewes-uckfield map
CycleHack Leeds slides
Cycle to bus stops potential to replace car trips - preliminary estimate for Minnesota
Input data:
Open tools for investment - Presentation in Parliament
Presentation to the APPWG
PCT DfT May 2018
Spatial classes
R for SSPA - recap
Franconia gr8
From the PCT to CyIPT
Cabinet Office Open Innovation Team presentation
On PCT and CyIPT
Gantt chart illustration made with vistime
See for reproducible code
Cycle Networks LDNP
Cycleways on busy roads
Heatmap test
FasterbyBike map1
Global map of coffee production - geocompr book
How to make a map of global coffee production in less than 20 lines of code? See here for details:
Global map of coffee production - geocompr book
How to make a map of global coffee production in less than 20 lines of code? See here for details:
Can Spatial Modelling Save the world?
Talk for Sheffield's White Rose DTC taster event
Isochrone map of time to Manchester airport
Generated with OTP thanks to code and tuition from Marcus Young
Computing Skills: Introduction to R
For the ITS Computer Skills course
Pedal, Park, Ride
For the TravelHackII
Cafe scientifque - Going Dutch
Cycle network Leeds - scenario from CyIPT
Generated by Malcolm Morgan and the CyIPT team at the University of Leeds
Implementing spatial interaction models: from prototype to globally scalable tools
Presented here:
Assessing the active travel impacts of major transport infrastructure projects
Slides presented at the RSAI conference, Harrogate, 2017-08-24:
The roundabaouts of Bristol
Route segment in Glasgow
Scalable methods for modelling movement patterns
Slides presented at the Dagstuhl summer school
Activity-space example
Developed as for the 'team 1' challenge at the Dagstuhl summer school:
Assessing the Potential for Uptake of Cycling to School: A Case Study of England
Slides for Pecha Kucha session at the International Conference for Transport and Health
A global propensity to cycle tool?
Slides for a panel session at the Scientists for Cycling Colloquium, Nijmegen, 2017.
Cycling Adventure map
PCU estimates for Bristol
To feed into the Cycling Infrastructure Prioritisation Toolkit (CyIPT) project
A4018 PCU estimates
Point pattern analysis of London Cycle Hire points
Based on code for the in-development geocompr book project:
Pubs in Poznan
As part of a course I teach in this wonderful Polish city. To reproduce this - see the source code here:
Data carpentry - for the PCT
Handling transport data
Data carpentry
Objects, functions, classes
Quietness of osm lines
In Bristol - thanks to and omsdata
Isolated TfL cycle docking stations
From the Creating-maps-in-R tutorial
Spatial Data Analysis with R
OSM cycleways in Bristol
Aim: fill the holes that are on the map but not in our data
Where will cycling grow?
leeds-cam rail route
R for transport applications
Overlay of cycle to school potential and cycle to work potential in Leeds
This is the Go Dutch scenario of the Propensity to Cycle Tool
Open source software for statistics and transport: a match made in heaven?
Talk for the Royal Statistical Society Bradford - see here for details:
TravelAIR, WebGL, Testing
Norton Canon Tithe example III
With custom tileserver providing default basemap this time (not projected right, I know)
Norton Canon Tithe example II
Another example of plotting land-use data with R/leaflet. Reproducible code and data lives here:
Norton Canon Tithe example
Example illustrating how to create a webmap with R/leaflet
Example of webgl using R's leaflet.extras package
Prototyping for the Propensity to Cycle Tool (PCT)
Methods for assessing the geographical distribution of cycling potential
Slides presented at the S4C colloquium in Aveiro, Portugal:
R for transport - slides
Open source software for transport planning
UCL Seminar at CASA
stplanr: a package for transport planning
Slides presented at eRum 2016
Introduction to Spatial Data in R
Slides explaining how R stores spatial data with the sp package
Visualising spatial data with R: from base to shiny
Slides to accompany my teaching materials at the first European R Users Meeting (eRum):
Leeds hilliness data
Hilly zones in The Netherlands
Administrative zones in Holland with an average gradient over 1%
Tools of the trade: adapting 20th century transport models for 21st century challenges
Presentation delivered at the 2016 Cycling and Society conference
Efficient R programming
Basic methods for analysing cycling potential in Seville
Slides presented at the Universidad de Sevilla
LAD results from the PCT
GIS for Transport Workshop
Presented at the RGS-IBG annual conference
Test colour scheme for the pct
Combined Authorities and some LEPS in England
Data from and Code:
The propensity to cycle tool rail stations
Slides for presentation at Seamless Travel event:
UK coastline II
UK coastline
UK coastline
Transforming CRSs in R
EU Referendum Results Map
Results from referendum, scraped from internet:
The case for open source software in transport modelling
Slides presented at the Radical Transport Conference, UCL, 20th June 2016
Poznan historic map
Cycling and transport policy: embedding active travel in every stage of the planning process
Slides for my talk at the Hackney Cycling Conference
London % conservative vote
Demo of tmap in interactive mode
Spatial data in R
Intermediate and advanced R for spatial data
Slides linking together content for 2 day course on R for spatial data
The propensity to cycle tool: from conception to national deployment
Slides presented at the Cycle City Active conference in Leicester
Modelling cycling potential for sustainable transport planning: a case study of the Propensity to Cycle Tool
Slides presented at the University of Cardiff, 4th May 2016. More info - see
Updated failing centroids
Before/after centroids
Modelling and visualising Big Data for active travel: lessons from the PCT
Slides from our presentation at the Obesity Network:
Data analytics for health
Slides for the health hackathon 2016
R for Spatial Data course slides
These slides accompany the 1 day course, An Introduction to R for Spatial Data.
Introduction to R and RStudio
Slides for a course teaching R and RStudio.
The Propensity to Cycle Tool: Software, design and uses
Slides providing an up-to-date overview of the open source strategic planning tool
WYCA propensity analysis 1
Route network - cyclists: Leeds
Output from the Propensity to Cycle project
The National Propensity to Cycle Tool - Cycling and Society conference
Slides with links from the Cycling in Society conference, Manchester 2015
Lancaster to Leeds route
My trip back from GEOSTAT in Lancaster to my home in Leeds
Viz Comp Entry
PCT: An open online planning tool for sustainable transport
My slides at the GEOSTAT summer school on the Propensity to Cycle Tool
Spatial interpolation with R
Testing rtop and pycno packages for transfering data across different boundary shapes
Test leaflet map of como
Introduction to spatial data with R
Slides from the workshop in FOSS4G-E
Introducing stplanr: a vignette
Vignette to accompany the stplanr package, available on github:
Percentage of commutes under 2km (Euclidean) by car in English and Welsh Local Authorities
This analysis demonstrates the high level of geographic variability in people's tendency to drive short distances across England and Wales. Across London boroughs, for example, less than 20% of very short commutes are made by car. In car-dominate commuter belts such as Bracknell, and rural areas potentially lacking quality public and active travel infrastructure, cars account for more than half of short journeys to work.
Percentage of commutes under 2km (Euclidean) by car in English and Welsh Local Authorities
This analysis demonstrates the high level of geographic variability in people's tendency to drive short distances across England and Wales. Across London boroughs, for example, less than 20% of very short commutes are made by car. In car-dominate commuter belts such as Bracknell, and rural areas potentially lacking quality public and active travel infrastructure, cars account for more than half of short journeys to work.
Multipart GeoJSON files in R
Related to
Flow data in R
Basic introduction to flow data in R
Download LAs and point-pattern analysis
Part of the Creating-maps-in-R tutorial
How to load and plot country-level data
Vignette from the Creating-maps-in-R tutorial
Popups of France from getData
From the Creating-maps-in-R vignette
5 bicycle accident hotspots in Leeds
Preliminary results of research identifying some of the worst accident hotspots in Leeds for cycling.
Clipping and aggregating with gIntersects
Using the power if the g* selection options for clipping and aggregating in R
Practical introduction to R
Slides for practical workshop in Girona
R for Spatial presentation
Slides to go with the popular tutorial,
Shiny for transport applications
Talk delivered at the University of Sydney's Institute of Transport and Logistics Studies (ITLS), 21st January 2015. This is in support of a workshop on learning shiny I delivered after the talk which is based on the free and open source learning-shiny tutorial I've developed: . Audio from the talk has been uploaded here:
KDE estimates 1
Systematic testing of methods for generating spatial microdata
Presented at the University of Wollongong, 19th Jan, 2015.
Lecture 1: Spatial microsimulation with R
Slides for NCRM Short Course in Cambrides, 18th - 19th September 2014
RSAI-BIS Presentation
Reproducibility in Regional Science
The classification of cycle paths in OSM
Small vignette of the many "ways" cycle paths are classified in Open Street Map (OSM) datasets.
Aggregating spatial points to reduce dataset size
Spatial aggregation of points by clusters of high density.
Open Street Map: loading, analysing and visualising free maps with R and QGIS
This tutorial discusses Open Street Map in general terms and describes how to analyse raw data using free software. The GitHub repository of this project can be found here
Measuring and simplifying spatial datasets in R
Miniature vignette to accompany Spatial Data Visualisation with R, an introductory book chapter on using R as a GIS - see preprint here:
An introduction to R for visualising spatial data
Slides for an introductory course on using R -
Introduction to visualising spatial data in R
This is the updated version of tutorial on spatial data handling and visualisation in R, with a focus on ggplot2 graphics. The project repository can be found here: . This work took place as part of a Short Course funded by the Geo-spatial Data Analysis and Simulation (TALISMAN) node of the National Centre for Research Methods (NCRM), which took place in Leeds, January 24th 2014.
Clipping with gIntersects
Supplementary material to the Introduction to visualising spatial data in R tutorial:
A demand-constrained spatial interaction model in R
Showcasing of the creation and analysis of a constrained spatial interaction model in R.
Coxcomb plots and 'spiecharts' in R
This was some fun I had trying to replicate Florence Nightingale's "Coxcomb plots" in ggplot and the more complex "spiecharts"
Some basic notes about the CO2 emissions of breathing and cycling
Estimates of the CO2 emissions of human respiration, with a focus on cycling.
Introduction to Spatial Data and ggplot2
An updated version of this tutorial on rpubs can be found here: The document maintained at Suggested improvements welcome.
Joining and clipping
Joining and clipping spatial data using base R and ggplot 'esque' packages.
Background maps in R
Intro to ggmaps, with some background maps
Curve fitting: R vs SPSS
Testing of R for curve fitting
Demonstration of nls function
This is a basic introduction to the nls function, using a worked example modified from Rossiter's 2009 Curve fitting tuturial.
A spatial interaction model of museum visits
Testing of a SI model of visitor flows to museums in R
Loading and preliminary analysis of twitter data
Preliminary analysis of twitter data
Ratmog 11: Linear Programming
R implementation of Hay, A. M. (1977). Linear Programming: elementary geographical applications of the transportation problem. Geo Abstracts Limited.
Evaluating the performance of IPF
Presentation for RSAI-BIS, Cambridge, 2013
Comparison of energy costs of commuting in England and the Netherlands
This illustrates code used to compare the energy costs of commuting, calculated in my previous Rpubs uploads.
Loading and plotting Dutch commuting data
This script shows how to convert Dutch commuting data into energy costs, following-on from the English data ( ). The raw data and code for this can be accessed here:
Loading and plotting english commuting data
Script illustrating how raw commuting data from the Census can be converted into energy costs for regions in England. To reproduce these results in their entirety, please download and extract the 'energy-nat' folder onto your computer and set this as your working directory in R:
Microsimulation - simple
Spatial microsimulation in R: a beginner’s guide to iterative proportional fitting (IPF)
Practical introduction to the Iterative Proportional Fitting (IPF) algorithm in R.
IPFinR a script for IPF in R
Shows an early version of the IPF script. The aim is to make it as generalised as possible; this is a step in that direction.
Spatial microsimulation in R
IPF code
Choropleth mapping
Examples of chloropleth map plotting based on "long" type destination-origin flow data for Sheffield, using GISTools and ggplot2 packages