Package 'covid19.nhs.data'

Title: Covid 19 England Hospital Admissions
Description: Facilitates access to data on English Covid-19 hospital admissions aggregated to a range of spatial scales.
Authors: Sophie Meakin [aut, cre], Sam Abbott [aut] , Sebastian Funk [aut]
Maintainer: Sophie Meakin <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-11-27 05:41:46 UTC
Source: https://github.com/epiforecasts/covid19.nhs.data

Help Index


Download English Hospital Trust Admissions Data

Description

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/

Usage

download_trust_data(release_date = Sys.Date())

Arguments

release_date

Date, release date of data to download. Will automatically find the Thursday prior to the date specified.

Value

A data.frame of hospital admissions by trust.


LTLA Shapefile for England

Description

LTLA Shapefile for England

Usage

england_ltla_shape

Format

An object of class sf (inherits from tbl_df, tbl, data.frame) with 317 rows and 11 columns.


UTLA Shapefile for England

Description

UTLA Shapefile for England

Usage

england_utla_shape

Format

An object of class sf (inherits from tbl_df, tbl, data.frame) with 151 rows and 11 columns.


Get Hospital Admissions

Description

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.

Usage

get_admissions(level = "trust", release_date = Sys.Date(), mapping, geo_names)

Arguments

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

data.frame containing trust_code, p_trust, geo_code and p_geo. Defaults to trust_utla_mapping if not supplied.

geo_names

A dataframe containing geo_code and geo_name. Used to assign meaningful to geographies.

Value

A data.frame of admissions by day either at trust, LTLA or UTLA levels.


Link Mapping to Trust and Geography Names

Description

Link Mapping to Trust and Geography Names

Usage

get_names(mapping, geo_names)

Arguments

mapping

data.frame containing trust_code, p_trust, geo_code and p_geo. Defaults to trust_utla_mapping if not supplied.

geo_names

A dataframe containing geo_code and geo_name. Used to assign meaningful to geographies.

Value

A data.frame containing a UTLA to trust level admissions map combined meaningful names.


Linking File Between LTLA Codes and Names

Description

Linking File Between LTLA Codes and Names

Usage

ltla_names

Format

An object of class tbl_df (inherits from tbl, data.frame) with 340 rows and 2 columns.


Map Admissions

Description

Map NHS Hospital aggregated admissions. By default this maps the latest data provided.

Usage

map_admissions(admissions, shapefile, date, scale_fill)

Arguments

admissions

A data.frame of admissions data as produced by get_dadmissions. Must contain the following variables: geo_code, date, and admissions

shapefile

A shapefile defaults to england_utla_shape if not supplied.

date

A date variable (or vector) indicating when to plot data for.

scale_fill

A ggplot2 scale_fill used to define the fill colours used in the map. The default is: scale_fill_viridis_c(option = "viridis", direction = -1).

Value

A map of Covid-19 admissions in England


Summarise Trust Mapping

Description

Summarise the Trust mapping (currently only supports the UTLA mapping) both graphically and in a table.

Usage

summarise_mapping(
  trust = NULL,
  geography = NULL,
  mapping,
  shapefile,
  geo_names
)

Arguments

trust

A character string indicating a trust of interest.

geography

A character string indicating the geography of interest. Only used if trust is not specified. Related to the mapping used so for trust_utla_mapping refers to a UTLA.

mapping

data.frame containing trust_code, p_trust, geo_code and p_geo. Defaults to trust_utla_mapping if not supplied.

shapefile

A shapefile defaults to england_utla_shape if not supplied.

geo_names

A dataframe containing geo_code and geo_name. Used to assign meaningful to geographies.

Value

A table and optional map summarising the admissions mapping.


Mapping Between NHS Trust and LTLA

Description

Mapping Between NHS Trust and LTLA

Usage

trust_ltla_mapping

Format

An object of class grouped_df (inherits from tbl_df, tbl, data.frame) with 590 rows and 4 columns.


Linking File Between NHS Trust Codes and Names

Description

Linking File Between NHS Trust Codes and Names

Usage

trust_names

Format

An object of class tbl_df (inherits from tbl, data.frame) with 228 rows and 2 columns.


Mapping Between NHS Trust and UTLA

Description

Mapping Between NHS Trust and UTLA

Usage

trust_utla_mapping

Format

An object of class grouped_df (inherits from tbl_df, tbl, data.frame) with 426 rows and 4 columns.


Linking File Between UTLA Codes and Names

Description

Linking File Between UTLA Codes and Names

Usage

utla_names

Format

An object of class tbl_df (inherits from tbl, data.frame) with 174 rows and 2 columns.