R code for creating a map of R(t) for England and Wales using data from LocalCovidTracker.
Two datasets are required to run this script: shapefiles of the UK and estimates of R(t).
- Estimates of R(t) by Lower Tier Local Authority (LTLA) are available from LocalCovidTracker. Within the "Daily tracker" tab, adjust the date range to include the date of interest and select "Lower Tier Local Authority" from the "Area type of interest" drop down menu, and click "Download CSV" on the "Instantaneous reproduction number" panel. The downloaded filename should be of the form
estimated.R.ltlas.*.csv
when downloaded from the Shiny App. This file should be placed within the folderdata/raw
and it's full name should be updated within theMakefile
(thelocalcovidtracker_filename
variable). - Shapefiles of the UK with 2019 Local Authority District codes are available from the ONS. Download the "Shapefiles" from this website and put the uncompressed folder within
data/raw
of this repository. The uncompressed folder name should be calledLocal_Authority_Districts__December_2019__Boundaries_UK_BUC-shp
and should include five different files.
- The R scripts within this repository require the following packages:
rgdal, broom, tidyverse, ggplot2
.
- Once downloaded, the following command wil clean both the R(t) and Shapefile data and produce a map for the date specified.
make r_date="2020-04-23" map
- Simply calling
make map
will produce a map for for 21st July 2020 (2020-07-21
) by default. - Dates can also be specified by day after 31st Dec 2019 (such that 1 is 1st day of the year of 2020):
make r_date=4 map
.
make data_covid19
will clean the R(t) COVID19 data (automatically called bymake map
).make data_shapefile
will clean the Shapefile (automatically called bymake map
). Within this project, this script simply moves the shapefiles to thedata/processed
folder but can include more elaborate scripts to simplify the shapefiles if necessary.- Generation of these plots on Oxford's Rescomp Cluster requires adjustments to the plotting script. See the commented command at the bottom of
src/visualisation/create_map_r_ew.R
for plotting on Rescomp. The scriptcreate_maps_rescomp.sh
will run these plotting commands in parallel (across multiple dates) on Rescomp.
Example output from calling make map
is the following file that is produced in output/figures
and shown at the top of this README.md file.