Title: | Client for the 'ONS' API |
---|---|
Description: | Client for the 'Office of National Statistics' ('ONS') API <https://api.beta.ons.gov.uk/v1>. |
Authors: | Kostas Vasilopoulos [aut, cre] |
Maintainer: | Kostas Vasilopoulos <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.2 |
Built: | 2025-01-13 02:46:46 UTC |
Source: | https://github.com/kvasilopoulos/onsr |
This function take you to the ONS' developer webpage.
ons_browse()
ons_browse()
An atomic character vector with the url of the webpage
ons_browse()
ons_browse()
This function take you to the QMI.
ons_browse_qmi(id = NULL)
ons_browse_qmi(id = NULL)
id |
|
An atomic character vector url with of the webpage
ons_browse_qmi("cpih01")
ons_browse_qmi("cpih01")
Used to get details about codes and code lists stored by ONS. Codes are used to provide a common definition when presenting statistics with related categories. Codes are gathered in code lists, which may change over time to include new or different codes. The meaning of a code should not change over time, but new codes may be created where new meaning is required.
ons_codelists() ons_codelist(code_id = NULL) ons_codelist_editions(code_id = NULL) ons_codelist_edition(code_id = NULL, edition = NULL)
ons_codelists() ons_codelist(code_id = NULL) ons_codelist_editions(code_id = NULL) ons_codelist_edition(code_id = NULL, edition = NULL)
code_id |
|
edition |
|
A list or character vector.
ons_codelists() ons_codelist(code_id = "quarter") #editions ons_codelist_editions(code_id = "quarter") ons_codelist_edition(code_id = "quarter", edition = "one-off")
ons_codelists() ons_codelist(code_id = "quarter") #editions ons_codelist_editions(code_id = "quarter") ons_codelist_edition(code_id = "quarter", edition = "one-off")
Used to get details about codes and code lists stored by ONS. Codes are used to provide a common definition when presenting statistics with related categories. Codes are gathered in code lists, which may change over time to include new or different codes. The meaning of a code should not change over time, but new codes may be created where new meaning is required.
ons_codes(code_id = NULL, edition = NULL) ons_code(code_id = NULL, edition = NULL, code = NULL) ons_code_dataset(code_id = NULL, edition = NULL, code = NULL)
ons_codes(code_id = NULL, edition = NULL) ons_code(code_id = NULL, edition = NULL, code = NULL) ons_code_dataset(code_id = NULL, edition = NULL, code = NULL)
code_id |
|
edition |
|
code |
|
A list or character vector.
#codes ons_codes(code_id = "quarter", edition = "one-off") ons_code(code_id = "quarter", edition = "one-off", code = "q2") ons_code_dataset(code_id = "quarter", edition = "one-off", code = "q2")
#codes ons_codes(code_id = "quarter", edition = "one-off") ons_code(code_id = "quarter", edition = "one-off", code = "q2") ons_code_dataset(code_id = "quarter", edition = "one-off", code = "q2")
A grouping of data (editions) with shared dimensions, for example Sex, Age and Geography, and all published history of this group of data. The options in these dimensions can change over time leading to separate editions. For example: Population Estimates for UK, England and Wales, Scotland and Northern Ireland.
ons_datasets() ons_ids()
ons_datasets() ons_ids()
A tibble with the datasets.
# Find all the information about the data ons_datasets() # Just the ids ons_ids()
# Find all the information about the data ons_datasets() # Just the ids ons_ids()
This function provides a description of the important information about a dataset.
ons_desc(id = NULL)
ons_desc(id = NULL)
id |
|
A description of the requested dataset.
ons_meta()
ons_desc("cpih01")
ons_desc("cpih01")
Data in each version is broken down by dimensions
, and a unique
combination of dimension options
in a version can be used to retrieve
observation
level data.
ons_dim(id = NULL, edition = NULL, version = NULL) ons_dim_opts( id = NULL, edition = NULL, version = NULL, dimension = NULL, limit = NULL, offset = NULL ) ons_meta(id = NULL, edition = NULL, version = NULL)
ons_dim(id = NULL, edition = NULL, version = NULL) ons_dim_opts( id = NULL, edition = NULL, version = NULL, dimension = NULL, limit = NULL, offset = NULL ) ons_meta(id = NULL, edition = NULL, version = NULL)
id |
|
edition |
|
version |
|
dimension |
|
limit |
|
offset |
|
A character vector.
## Not run: ons_dim(id = "cpih01") ons_dim_opts(id = "cpih01", dimension = "time") ons_meta(id = "cpih01") ## End(Not run)
## Not run: ons_dim(id = "cpih01") ons_dim_opts(id = "cpih01", dimension = "time") ons_meta(id = "cpih01") ## End(Not run)
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()
.
ons_get( id = NULL, edition = NULL, version = NULL, ons_read = getOption("onsr.read"), ... ) ons_get_obs(id = NULL, edition = NULL, version = NULL, ...)
ons_get( id = NULL, edition = NULL, version = NULL, ons_read = getOption("onsr.read"), ... ) ons_get_obs(id = NULL, edition = NULL, version = NULL, ...)
id |
|
edition |
|
version |
|
ons_read |
|
... |
Further arguments passed on the methods. |
A tibble with the dataset in tidy format.
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 = "*")
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 = "*")
This functions are used to access the latest href
, version
and edition
of a dataset.
ons_latest_href(id = NULL) ons_latest_version(id = NULL) ons_latest_edition(id = NULL)
ons_latest_href(id = NULL) ons_latest_version(id = NULL) ons_latest_edition(id = NULL)
id |
|
An atomic character vector with the latest info.
ons_latest_href("cpih01") ons_latest_version("cpih01") ons_latest_edition("cpih01")
ons_latest_href("cpih01") ons_latest_version("cpih01") ons_latest_edition("cpih01")
Search for a Dataset
ons_search(id, edition = NULL, version = NULL, name = NULL, query = NULL)
ons_search(id, edition = NULL, version = NULL, name = NULL, query = NULL)
id |
|
edition |
|
version |
|
name |
|
query |
|
A data.frame.
ons_dim("cpih01") ons_search("cpih01", name = "aggregate", query = "cpih1dim1A0")
ons_dim("cpih01") ons_search("cpih01", name = "aggregate", query = "cpih1dim1A0")