knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/", eval = TRUE )
This package contains a many-to-many mapping between local authority districts and NHS Acute Trusts in England; details of this mapping (including a summary of the methods and a quick-start guide) can be found in vignettes/mapping-summary.
This package also has functionality to download trust-level hospital admissions data, published weekly on the NHS COVID-19 Hospital Activity webpage. Data published on date YYYY-MM-DD
can be downloaded using the function get_admissions(release_date = "YYYY-MM-DD")
. This function can also be used to return estimated admissions by upper-tier and lower-tier local authorities. See the quick start below, the vignettes, and the package documentation for more.
Install the stable development version of the package from our r-universe:
install.packages( "covid19.nhs.data", repos = c(ropensci = 'https://epiforecasts.r-universe.dev', CRAN = 'https://cloud.r-project.org') )
Or from GitHub:
remotes::install_github("epiforecasts/covid19.nhs.data")
Load the package.
library(covid19.nhs.data)
Download the latest admissions mapped to lower-tier local authority (LTLA) using the default mapping. Note: This data is updated weekly each Thursday and the mapping is a probabilistic estimate.
adm <- get_admissions("ltla")
Map the latest available estimates by LTLA using one of the built in package shapefiles.
map_admissions(adm, england_ltla_shape)
Plot the time series of estimated admissions in an example LTLA (here Derby).
library(ggplot2) library(dplyr) adm %>% filter(geo_name %in% "Derby") %>% ggplot(aes(x = date, y = admissions)) + geom_col(width = 0.9, col = "grey50", fill = "grey85") + theme_minimal() + labs(x = "Date", y = "Daily Hospital Admissions", title = "Covid-19 Admissions in Derby", subtitle = "Estimated using a probabilistic mapping from NHS Trusts to lower-tier local authority level")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.