-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathREADME.Rmd
More file actions
77 lines (57 loc) · 3 KB
/
Copy pathREADME.Rmd
File metadata and controls
77 lines (57 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/",
eval = TRUE
)
```
# NHS trust level Covid-19 data aggregated to a range of spatial scales
[](https://www.tidyverse.org/lifecycle/#experimental)
[](https://github.com/epiforecasts/covid19.nhs.data/actions)
[](https://codecov.io/gh/epiforecasts/covid19.nhs.data?branch=master)
[](https://zenodo.org/badge/latestdoi/312314841)
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](https://epiforecasts.io/covid19.nhs.data/articles/mapping_summary.html).
This package also has functionality to download trust-level hospital admissions data, published weekly on the [NHS COVID-19 Hospital Activity](https://www.england.nhs.uk/statistics/statistical-work-areas/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.
## Installation
Install the stable development version of the package from our [r-universe](https://epiforecasts.r-universe.dev):
```{r, eval = FALSE}
install.packages(
"covid19.nhs.data",
repos = c(ropensci = 'https://epiforecasts.r-universe.dev',
CRAN = 'https://cloud.r-project.org')
)
```
Or from GitHub:
```{r, eval = FALSE}
remotes::install_github("epiforecasts/covid19.nhs.data")
```
## Quick start
Load the package.
```{r}
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.*
```{r}
adm <- get_admissions("ltla")
```
Map the latest available estimates by LTLA using one of the built in package shapefiles.
```{r map}
map_admissions(adm, england_ltla_shape)
```
Plot the time series of estimated admissions in an example LTLA (here Derby).
```{r timeseries}
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")
```