read_release: read_release

View source: R/read_release.R

read_releaseR Documentation

read_release

Description

Returns the releases data for the given data set - ECONDATA:id(version), as a list, or as tidy data.table's. Tidying can be done directly within read_econdata(), or ex-post using econdata_tidy().

Usage

read_release(id, tidy = TRUE, ...)
## S3 method for class 'eds_release'
tidy_data(x, ...)

Arguments

id

Data identifier.

x

A raw API return object to be tidied. Can also be done directly in read_release() by setting tidy = TRUE. See tidy below for tidying options.

...

Further optional arguments:

agencyid character. Defaults to ECONDATA. Agency responsible for the metadata creation/maintenance.
version Version of the data definition.
before datetime. Returns all releases before a certain date.
after datetime. Returns all releases after a certain date.
description character. Returns the release whose description matches the given string.
tidy

logical. Return releases in a tidy data.table (see Value) with "metadata" attached in an attribute.

Details

Specifying the full dataflow and data provider details (as opposed to only using the data id) allows more fine-grained control over the data set being queried. This is not necessary if there is only a single definition of the data and a single provider, which is typically the case.

An EconData account is required to use this function. The user must provide an API token, which can be found on the Account page of the online portal. A GUI dialog will prompt the user for their API token. Credentials can also be supplied by setting the ECONDATA_CREDENTIALS environment variable using the syntax: "client_id;client_secret", e.g. Sys.setenv(ECONDATA_CREDENTIALS="client_id;client_secret"), when available.

Value

If tidy = FALSE, a nested lists containing metadata and release desciption and dates. If tidy = TRUE, a (list of) data.table(s) providing release information, with metadata attached as an attribute.

See Also

write_release read_econdata

Examples

## Not run: 
# library(econdatar)

# Mining production and sales
MINING_RELEASE <- read_release(id = "MINING", tidy = FALSE)
# Same as: read_release(id = "MINING", tidy = TRUE)
tidy_data(MINING_RELEASE) # No further options supported.

# Releases for all data set versions
read_release(id = "CPI_ANL_SERIES", version = "all")

## End(Not run)

coderaanalytics/econdatar documentation built on Feb. 19, 2025, 10:37 p.m.