knitr::opts_chunk$set(echo = FALSE, message = FALSE) pacman::p_load( magrittr, dplyr, knitr, kableExtra )
The covid19.nhs.data package contains four many-to-many (overlapping) mappings between local authority districts (upper- and lower-tier) and NHS Acute Trusts in England. Each mapping contains the following variables:
geo_code: A 9-digit identifier for local authorities (UTLA or LTLA) in England.trust_code: A 3-digit organisation code for NHS Trusts.p_geo: The proportion of all admissions from a given local authority (LTLA or UTLA) that were admitted to a given Trust, estimated from one of two datasets (see below).p_trust: The proportion of all admissions to a given Trust that were admitted from a given local authority (LTLA or UTLA), estimated from one of two datasets (see below).These mappings are probabilistic estimates based on Secondary Uses Service (SUS) healthcare data for England (January - September 2020, inclusive), and linked COVID-19 cases and admissions (June 2020 - May 2021, inclusive). Please see the vignette "Creating the public mappings" for details of how the mappings are made.
These mappings can be used to estimate COVID-19 hospital admissions at the local authority level, or to estimate "relevant" community COVID-19 cases for an NHS Trust. These are estimates only and may not accurately reflect the truth; see limitations below.
Install the package from GitHub:
devtools::install_github("epiforecasts/covid19.nhs.data")
and load the library:
library(covid19.nhs.data)
Access the mappings with load_mapping(), specifying the geographical scale ("ltla" or "utla") and the data source ("sus" or "link"):
load_mapping(scale = "ltla", source = "link") %>% head() %>% kable() %>% kable_styling()
Add Trust names and local authority names to the raw mapping with get_names():
load_mapping(scale = "ltla", source = "link") %>% get_names(geo_names = ltla_names) %>% head() %>% kable() %>% kable_styling()
Summarise the mapping with summarise_mapping().
For an NHS Trust (specified by the argument trust), this will return a table and a visualisation, both describing p_trust:
mapping <- load_mapping(scale = "ltla", source = "link") summary <- summarise_mapping(trust = "RYR", mapping = mapping, shapefile = england_ltla_shape, geo_names = ltla_names) summary$summary_table %>% kable() %>% kable_styling() summary$summary_plot
For a local authority (specified by the argument geography), this will return a table describing p_trust:
summary <- summarise_mapping(geography = "E09000012", mapping = mapping, shapefile = england_ltla_shape, geo_names = ltla_names) summary$summary_table %>% kable() %>% kable_styling()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.