read_release: read_release

View source: R/read_release.R

read_releaseR Documentation

read_release

Description

Returns the 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 = FALSE, ...)
## 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 (http://econdata.co.za) is required to use this function. The user must provide an API token that 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)

# Bank Balance Sheet (institutional)
MINING_RELEASE <- read_release(id = "MINING")
# Same as: read_release(id = "BA900", tidy = TRUE)
econdata_tidy(MINING_RELEASE, is_release = TRUE) # No further options supported.

# Releases for all CPI Revisions
read_release(id = "CPI_ANL_SERIES", version = "all", tidy = TRUE)

## End(Not run)

coderaanalytics/econdatar documentation built on Nov. 1, 2024, 5:41 a.m.