Learn R Programming

epidm

epidm provides standard methods for the management and transformation of UK Public Health data in R

Installation

epiviz can be installed from GitHub using the following code:

# Install epidm
remotes::install_github('ukhsa-collaboration/epidm')

# To install the development version
remotes::install_github("ukhsa-collaboration/epidm@dev")

Purpose

The epidm package has been developed to share standard methods for the processing of epidemiological data in the UK. Key data assets this focuses on include

Infection data

The Second Generation Surveillance System (SGSS) is a data asset held by the UK Health Security Agency (formerly Public Health England) which routinely and automatically collects laboratory data from across England.

Laboratories return data on organisms isolated from samples such as the organism species, specimen type, sampling date and antimicrobial susceptibility testing results. These data are routinely used for public health surveillance and epidemiology in England.

Hospital data

The functions for dealing with hospital data within epidm are designed to help clean, process, and link the hospital in a meaningful way. These methods have been used to help understand Healthcare Associated COVID-19 in England.

Emergency Care Data Set (ECDS)

ECDS is the national data set for urgent and emergency care and is reported daily by NHS Trusts.

Secondary Use Services (SUS)

SUS is the single, comprehensive repository for healthcare data in England which enables a range of reporting and analyses to support the NHS in the delivery of healthcare services. SUS is reported monthly, by the 21st of each month for the previous months data.

Hospital Episode Statistics (HES)

HES is a data warehouse containing details of all admissions, outpatient appointments and A and E attendances at NHS hospitals in England. Hes is reported quarterly, and is a 'cleaned' version of SUS and ECDS.

Copy Link

Version

Install

install.packages('epidm')

Monthly Downloads

333

Version

1.0.6

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Frederick Sloots

Last Published

February 25th, 2026

Functions in epidm (1.0.6)

specimen_type_grouping

Specimen type grouping
sql_connect

Connect to a SQL database
lookup_recode

Lookup table switch handler
respeciate_generic

Respeciate unspecified samples
sql_read

Read a table from a SQL database
sql_clean

Clean and Read a SQL query
proxy_episode_dates

Clean and Impute HES/SUS Episode Start and End Dates
respeciate_organism

Respeciated organisms
link_ae_inpatient

Link A&E (ECDS) records to Inpatient (HES/SUS) spells
sql_write

Write a table to a SQL database
valid_nhs

NHS Number Validity Check
uk_patient_id

Patient ID record grouping
group_inpatient_discharge_destination

Inpatient discharge destination
genus_gram_stain

Bacterial Genus Gram Stain Lookup Table
csv_from_zip

Download a csv from a zip
hospital_in_out_dates

Hospital IN/OUT dates
group_time

Grouping of intervals or events that occur close together in time
inpatient_codes

Inpatient Codes cleanup
cip_spells

Continuous Inpatient (CIP) Spells
lab_data

Synthetic Lab Data for epidm
group_ecds_discharge_destination

A&E attendance discharge destination
group_inpatient_admission_method

Inpatient admission methods