Title: | NHS Trust Level COVID-19 Data Aggregated to a Range of Spatial Scales |
---|---|
Description: | Facilitates access to data on NHS trust level COVID-19 data aggregated to a range of spatial scales. |
Authors: | Sophie Meakin [aut, cre] , Sam Abbott [aut] , Hannah Choi [aut], Sebastian Funk [aut], Hugo Gruson [ctb] |
Maintainer: | Sophie Meakin <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-08-18 04:33:44 UTC |
Source: | https://github.com/epiforecasts/covid19.nhs.data |
Downloads English hospital admissions data by Trust. Data is released each Thursday. See here for details: https://www.england.nhs.uk/statistics/statistical-work-areas/covid-19-hospital-activity/
download_trust_data(release_date = Sys.Date())
download_trust_data(release_date = Sys.Date())
release_date |
Date, release date of data to download. Will automatically find the Thursday prior to the date specified. |
A data.frame of hospital admissions by trust.
LTLA Shapefile for England
england_ltla_shape
england_ltla_shape
An object of class sf
(inherits from tbl_df
, tbl
, data.frame
) with 314 rows and 11 columns.
UTLA Shapefile for England
england_utla_shape
england_utla_shape
An object of class sf
(inherits from tbl_df
, tbl
, data.frame
) with 151 rows and 11 columns.
Downloads hospital admissions by Hospital trust using
download_trust_data
and then optionally aggregates to either LTLA or UTLA
level. This can be done either with the built in mapping or a user supplied mapping.
get_admissions( keep_vars = "new_adm", level = "trust", release_date = Sys.Date(), mapping, geo_names )
get_admissions( keep_vars = "new_adm", level = "trust", release_date = Sys.Date(), mapping, geo_names )
keep_vars |
Character string, defaulting to "new_adm" (first-time COVID-19 hospital admissions). Defines which variables to keep from the raw data. Other supported options are: "all_adm" (for all COVID-19 hospital admissions), and "all_bed" (for all COVID-19 beds occupied). Multiple values allowed. |
level |
Character string, defaulting to "trust". Defines the level of aggregation at which to return the data. Other supported options are "utla" for UTLA level admissions or "ltla" for LTLA level admissions. |
release_date |
Date, release date of data to download. Will automatically find the Thursday prior to the date specified. |
mapping |
A data.frame containing geo_code, trust_code, p_geo and p_trust. |
geo_names |
A data.frame containing |
A data.frame of daily admissions and/or bed occupancy data, reported at the Trust, LTLA or UTLA level. Note that new admissions ("new_adm") are called "admissions" in the data.frame to be consistent with a previous version of this function.
Link Mapping to Trust and Geography Names
get_names(mapping, geo_names)
get_names(mapping, geo_names)
mapping |
A data.frame containing geo_code, trust_code, p_geo and p_trust. |
geo_names |
A data.frame containing |
A data.frame containing a UTLA to trust level admissions map combined meaningful names.
Load LTLA- or UTLA-Trust mappings from two data sources: HES (Hospital Episodes Statistics) until September 2020, and linked COVID-19 cases and admissions June 2020 - May 2021. Replaces previous datasets trust_ltla_mapping and trust_utla_mapping (the HES mappings).
load_mapping(scale, source)
load_mapping(scale, source)
scale |
Character string defining the geographical scale. Supported options are "ltla" (lower-tier local authority) and "utla" (upper-tier local authority). |
source |
Character string defining the souce of the mapping. supported options are "link" (linked COVID-19 cases and admissions) and "sus" (Secondary Uses Service, originally the only mapping available). |
A data.frame with the following columns: geo_code
(9-digit LTLA or UTLA ID); trust_code
; n
(the number of reported admissions); p_geo
(the proportion of all admissions from a LTLA/UTLA that go to a given Trust); p_trust
(the proportion of all admissions to a Trust that come from a given LTLA/UTLA); source
("SUS" or "Link"); and level
("ltla" or "utla").
Linking File Between LTLA Codes and Names
ltla_names
ltla_names
An object of class tbl_df
(inherits from tbl
, data.frame
) with 340 rows and 2 columns.
Map NHS Hospital aggregated admissions. By default this maps the latest data provided.
map_admissions(admissions, shapefile, date, scale_fill)
map_admissions(admissions, shapefile, date, scale_fill)
admissions |
A data.frame of admissions data as produced by |
shapefile |
A shapefile defaults to |
date |
A date variable (or vector) indicating when to plot data for. If
set to |
scale_fill |
A |
A map of Covid-19 admissions in England
Summarise the Trust mapping (currently only supports the UTLA mapping) both graphically and in a table.
summarise_mapping( trust = NULL, geography = NULL, mapping, shapefile, geo_names )
summarise_mapping( trust = NULL, geography = NULL, mapping, shapefile, geo_names )
trust |
A character string indicating a trust of interest. |
geography |
A character string indicating the geography of interest. Only used if
|
mapping |
A data.frame containing geo_code, trust_code, p_geo and p_trust. |
shapefile |
A shapefile defaults to |
geo_names |
A data.frame containing |
A table and optional map summarising the admissions mapping.
List of Trust Mergers
trust_mergers
trust_mergers
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 11 rows and 3 columns.
Linking File Between NHS Trust Codes and Names
trust_names
trust_names
An object of class tbl_df
(inherits from tbl
, data.frame
) with 228 rows and 2 columns.
Linking File Between UTLA Codes and Names
utla_names
utla_names
An object of class tbl_df
(inherits from tbl
, data.frame
) with 174 rows and 2 columns.