Member-only story
Painting a portrait
How do COVID-19 admissions evolve over time?
‘Protect the NHS’ is the appeal from the UK government, ordering people to stay at home. Pressure on healthcare services is important to understand during a pandemic.

How do COVID-19 admissions and patient levels change over time?
Evolving over time
We can plot COVID-19 admissions and COVID-19 patients in hospitals in England. NHS England use the following definitions:
- COVID-19 admission: admissions with positive tests plus in-patient diagnoses. For hospital admissions, the person must have a positive SARS-CoV-2 test in the prior 14 days. NHS England counts in-patient diagnoses against the day before their diagnosis.
- COVID-19 patients (or hospital cases): the number of confirmed COVID-19 patients in hospital at 8am. This measure includes all hospitals.
Prof Johnson (Bristol) produces graphs showing admissions and patients over time.
Using R, we are going to produce a similar graph using ggplot2
.
Straight from the API
Public Health England provide an interface for their data-set. That means we can download an R package, rather than upload data via spreadsheets.
library(tidyverse)
library(lubridate)
library(scales)
library(ukcovid19)
Depending on your version, you may need to use remotes
to install the PHE package:
library(remotes)
remotes::install_github("publichealthengland/coronavirus-dashboard-api-R-sdk")
That allows to draw numbers straight from the interface.
First, we have to set the ‘structure’ of our data request:
covid19_structure <- list(
date = "date",
areaType = "areaType",
areaName = "areaName",
areaCode = "areaCode",
newAdmissions = "newAdmissions",
hospitalCases = "hospitalCases")
The two measures of interest are newAdmissions
and hospitalCases
.