The ukhsadatR
package provides easy access to UK Health
Security Agency (UKHSA) data via their API.
Below demonstrates how to retrieve daily reported COVID-19 cases at the national level for England:
library(ukhsadatR)
get_data(
theme = "infectious_disease",
sub_theme = "respiratory",
topic = "COVID-19",
geography_type = "Nation",
geography = "England",
metric = "COVID-19_cases_casesByDay"
) |>
head()
#> theme sub_theme topic geography_type geography
#> 1 infectious_disease respiratory COVID-19 Nation England
#> 2 infectious_disease respiratory COVID-19 Nation England
#> 3 infectious_disease respiratory COVID-19 Nation England
#> 4 infectious_disease respiratory COVID-19 Nation England
#> 5 infectious_disease respiratory COVID-19 Nation England
#> 6 infectious_disease respiratory COVID-19 Nation England
#> geography_code metric metric_group stratum sex age year
#> 1 E92000001 COVID-19_cases_casesByDay cases default all all 2020
#> 2 E92000001 COVID-19_cases_casesByDay cases default all all 2020
#> 3 E92000001 COVID-19_cases_casesByDay cases default all all 2020
#> 4 E92000001 COVID-19_cases_casesByDay cases default all all 2020
#> 5 E92000001 COVID-19_cases_casesByDay cases default all all 2020
#> 6 E92000001 COVID-19_cases_casesByDay cases default all all 2020
#> month epiweek date metric_value in_reporting_delay_period
#> 1 1 5 2020-01-30 1 FALSE
#> 2 1 5 2020-01-31 0 FALSE
#> 3 2 5 2020-02-01 0 FALSE
#> 4 2 5 2020-02-02 1 FALSE
#> 5 2 6 2020-02-03 18 FALSE
#> 6 2 6 2020-02-04 0 FALSE