ons_get {onsr}R Documentation

Download data from ONS

Description

This functions is used to find information about data published by the ONS. Datasets are published in unique versions, which are categorized by edition. Available datasets are given an id. All available id can be viewed with ons_ids().

Usage

ons_get(
  id = NULL,
  edition = NULL,
  version = NULL,
  ons_read = getOption("onsr.read"),
  ...
)

ons_get_obs(id = NULL, edition = NULL, version = NULL, ...)

Arguments

id

⁠[character]⁠ Id that represents a dataset.

edition

⁠[character]⁠ A subset of the dataset representing a specific time period. For some datasets this edition can contain all time periods (all historical data). The latest version of this is displayed by default.

version

⁠[character]⁠ A specific instance of the edition at a point in time. New versions can be published as a result of corrections, revisions or new data becoming available.

ons_read

⁠[character]⁠. Reading backend, one of readr, data.table or vroom.

...

Further arguments passed on the methods.

Value

A tibble with the dataset in tidy format.

Examples


ons_get(id = "cpih01")

# Same dataset but older version
ons_get(id = "cpih01", version = "5")


# Take only specific observations
ons_get_obs("cpih01", geography = "K02000001", aggregate = "cpih1dim1A0", time = "Oct-11")

# Or can use a wildcard for the time
ons_get_obs("cpih01", geography = "K02000001", aggregate = "cpih1dim1A0", time = "*")




[Package onsr version 1.0.2 Index]