Project: ScotSport - sports facilities in Scotland
Map and searchable directory
data cleaning, data wrangling, Quarto, R, R Shiny, Scotland, sport

Project information
- Project date: Autumn 2024
- Deliverable: R Shiny web application
- Technologies: R, R Shiny, Quarto,
{bslib},{leaflet} - Geographical scope: Scotland
- Type: Unpaid, personal learning, competition submission
- Status: complete
- Link: ScotSport
- Code: ScotSport GitHub repository

Sportscotland - the national agency for sport in Scotland has recorded the locations of sports facilities in Scotland and made that data available as an open data dataset. This app uses the data to show how many, where and what types of facility are available. This data has been processed and combined with other geographical and population information.
For all of Scotland or for individual council areas the following information is available:
- Map of Scotland showing how many facilities are in each council area
- how many people per facility in their area
- how many towns have at least one facility
- The user can pick a town and see on a map where they are located. Clicking on the pins shows more detail about the facility
- The type of facility and any subtype e.g, Pitches and Pitch - Football (5-a-side)
- A searchable and filterable table of all records by the recorded address
Data sources
This app uses the following open data
- Sports facilities - Sportscotland
- Local authority boundaries - Improvement Service, Spatial Hub Scotland
- Scottish population data - National Records of Scotland
Technical
This app is a Quarto dashboard using R Shiny for interactivity. A separate Quarto profile is used to coordinate the downloading and cleaning scripts to generate the dataset that the Shiny app uses.
Background
I was keen to further my knowledge of geospatial techniques so wanted to learn how to build choropleth maps in R using Scottish open data for Scottish Local Authority boundaries. I wanted to find who is the custodian of the official boundary data for council areas.
I also wanted to learn how to build a hybrid Quarto/R Shiny app. I saw this potential type of app listed in the Quarto documentation but at the time hadn’t seen any full examples so this was a bit of a journey into the unknown.
I’m particularly proud of embedding an easter egg for older Scottish people who remember STV presenter Arthur Montsford and his legendary houndstooth jacket.
I wanted to allow people the ability to see not just their local council area but more narrowly their actual town. Unfortunately that was the part of the dataset that was least consistent I got the impression people are typing that manually rather than picking an address from a database. A great deal of time was spent cleaning to avoid the same towns appearing under slightly different spellings.
After I had already started work on the project Posit announced the 2024 Shiny Contest. See my ScotSport contest submission.
Prior experience
Years ago I was a developer in the Education sector. When I was building the app I was thinking back to when people like PE teachers would try to encourage children to become involved in sport outside school and in their local communities. They worked to try and source suitable contacts and information to help connect pupils to local clubs. I was very much thinking of them and the general public as the intended audience so the interface is deliberately simple.
In a similar vein, previously I worked on early versions of a co-produced map project for wellbeing East Dunbartonshire Assets. That map spread by word of mouth and was (still is?) a big hit with local GPs and other community health professionals as well as users. The feedback at the time was that it was so helpful for doctors to be able to recommend local assets. Patients were often unaware of facilities near to where they live. Also valuable was GPs could print off customised information for those without internet access for social prescribing for health and wellbeing. So it helped bridge the digital divide.
See official project materials:
My abiding memory processing the raw submissions from users of what they found most helpful for their own wellbeing was how often people value not just buildings and services but also spaces between them particularly green spaces like parks for walking. This is a free activity doable by many people unable to tke part in more vigorous sport. Being around grass and trees helped people with thyeir mental health and stress management. Also interesting was how frequently in rural areas in places in Scotland where no official sport halls exist, local church halls play a vital role in providing safe and affordable spaces for indoor activities and clubs.
I thought a tool like ScotSport could build on what I learned from East Dunbartonshire but on a national level. There are various schemes to try and encourage more active lifestyles and travel in Scotland.
Citation
@online{duff2025,
author = {Duff, Lesley K.},
title = {Project: {ScotSport} - Sports Facilities in {Scotland}},
date = {2025-09-01},
url = {https://www.dataquine.dev/projects/scotsport/},
langid = {en-GB}
}