Package 'ukhsadatR'

Title: R Interface to Access UKHSA Dashboard Data
Description: Programmatic interface to access data from the UK Health Security Agency (UKHSA) Data Dashboard API. The package was originally based on the 'ukcovid19' package by Pouria Hadjibagheri and has been substantially rewritten and extended. For more information on the API, see <https://ukhsa-dashboard.data.gov.uk/access-our-data>.
Authors: Ollie Lloyd [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-9385-1634>), Pouria Hadjibagheri [ctb] (Author of the original 'ukcovid19' package.)
Maintainer: Ollie Lloyd <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2026-10-11 12:43:20 UTC
Source: https://github.com/silverfoxdoc/ukhsadatr

Help Index


Get Data

Description

Iteratively runs get_paginated_data to download all results and combine them into a data.frame.

Usage

get_data(
  theme = NULL,
  sub_theme = NULL,
  topic = NULL,
  geography_type = NULL,
  geography = NULL,
  metric = NULL
)

Arguments

theme

the largest overall topical subgroup of data. For example infectious_disease.

sub_theme

a topical subgroup associated with the parent theme. For example respiratory.

topic

categorical subgroup associated with the selected theme and sub_theme. For example, COVID-19.

geography_type

the overarching area type for the intended geography. For example Nation.

geography

the selected area under the geography_type. For example England.

metric

the type of data being selected. For example COVID-19_testing_PCRcountByDay.

Details

For further information on the UKHSA dashboard API please visit the API documentation.

          If any input argument is left NULL or invalid, a list
                   of possible values for that parameter is returned.

Value

           data.frame containing the query results

Examples

get_data(
  theme = "infectious_disease",
  sub_theme = "respiratory",
  topic = "COVID-19",
  geography_type = "Nation",
  geography = "England",
  metric = "COVID-19_cases_casesByDay"
) |>
  head()

Get Paginated Data

Description

Generates API query URL and retrieves paginated data.

Usage

get_paginated_data(
  theme = NULL,
  sub_theme = NULL,
  topic = NULL,
  geography_type = NULL,
  geography = NULL,
  metric = NULL,
  page_number = 1,
  page_size = 365
)

Arguments

theme

the largest overall topical subgroup of data. For example infectious_disease.

sub_theme

a topical subgroup associated with the parent theme. For example respiratory.

topic

categorical subgroup associated with the selected theme and sub_theme. For example, COVID-19.

geography_type

the overarching area type for the intended geography. For example Nation.

geography

the selected area under the geography_type. For example England.

metric

the type of data being selected. For example COVID-19_testing_PCRcountByDay.

page_number

define which page of data to retrieve

page_size

define number of results returned per page. Maximum supported size is 365.

Details

          If any input argument is left NULL or invalid, a list
                   of possible values for that parameter is returned.

Value

           list containing the query structure and results

Examples

get_paginated_data(
  theme = "infectious_disease",
  sub_theme = "respiratory",
  topic = "COVID-19",
  geography_type = "Nation",
  geography = "England",
  metric = "COVID-19_cases_casesByDay",
  page_number = 2,
  page_size = 6
)