Publications by mikerspencer

Network analysis video – 7th Scottish QGIS user group

17.11.2017

I spoke yesterday at the Scottish QGIS user group. This is a vibrant and welcoming community and has attendees who travel long distances to be there. I think this time Prague was the furthest city anybody came from. My talk centred on network analysis using GRASS, R and QGIS. You can read how to do some of this work here and here. Watch the prese...

909 sym 4 img

Getting started with spatial data in R – EdinbR talk

18.01.2018

Last night (2018-01-17) I spoke at the EdinbR user group alongside Susan Johnston. Susan talked about writing R packages and you see her slides here. I gave an introduction to working with spatial data in R. You can see my slides below: Related To leave a comment for the author, please follow the link and comment on their blog: R – scottishs...

636 sym

DfT traffic count data in R

26.01.2018

I read this tweet thread yesterday, and one of the great things in it was discovering that the Department for Transport release traffic count data for Great Britain. When you download individual observation locations you get a csv with a few years data. I checked out the one for a street near where I live using R (code at the bottom of this post)...

1314 sym R (331 sym/1 pcs) 4 img

dplyr, (mc)lapply, for-loop and speed

18.02.2018

I was at EdinbR on Friday evening and David Robinson‘s talk prompted some excellent discussions, not least with Isla and Gergana. One topic was on dplyr and lapply. I started using R in 2012, just before dplyr came to prominence and so I seem to have one foot in base and the other in the tidyverse. Ambitiously aiming for the best of both worlds...

4640 sym R (2930 sym/10 pcs) 4 img 1 tbl

GB postcode polygons – open data

28.03.2018

Postcode district and area polygons available. These days I’m working with a lot of data about people. Often surveys, but also administrative data. I usually want to represent these on a map. To preserve anonymity I aggregate dataset before plotting them. This might be at a local authority level, but more often it is via postcode. In the UK a p...

1993 sym R (1537 sym/2 pcs) 2 img

Ordnance Survey Terrain 50: merging in R

16.04.2018

I’ve written previously about Ordnance Survey’s Terrain 50 data and how you can merge it together. You can download the dataset from the OS’s opendata repo. I’d like to update that post with merging in R. Once you’ve extracted your zipped zips, you can run the following to merge to a single geotiff file: library(rgdal) library(gdalUtils...

787 sym R (172 sym/1 pcs)

Presenting survey data

03.07.2018

I work in a social science and economics department and a lot of our work is based on surveys of opinion. One question style we use a lot is likert, I’ve tried a few ways to present these results. My current favourite is a stacked bar graph, ordered by agreement. I’ve created an example of this using data from a political blog. I was struggli...

1621 sym R (639 sym/2 pcs) 4 img

Many reports from 1 RMarkdown file

17.08.2018

I was at the EdinbR talk this week by the RStudio community lead – Curtis Kephart. It was really interesting, but I disagree with his suggestion to point and click different parameters when you want to generate multiple reports from the same RMarkdown file. This might be acceptable if you have one or two, but any more and the chance for error a...

2532 sym R (1934 sym/3 pcs)

Monitoring electricity use

10.10.2018

My partner and I are considering installing photo voltaic (PV) solar panels. We had solar thermal (hot water) panels in our old house, but our new property has a very different heating system. The air source heatpump which heats our home is excellent and means we have no use for gas, but our electricity use is much higher now it is our only energ...

2226 sym R (1122 sym/1 pcs) 2 img

I fell out with tapply and in love with dplyr

15.10.2018

A long time ago (5 years) I wrote a blog post on tapply. Back then I was just getting into programming and I thought the possibilities of tapply were amazing. So it seems, do many others as it’s become one of my most viewed articles. However, I never use tapply these days because the output is either a named vector or a matrix. Both of these re...

1356 sym R (593 sym/1 pcs) 2 img