| importData | R Documentation |
Import a Flat OECD Dataset.
importData(OECDDatasetCode, filters = NULL)
OECDDatasetCode |
A catalogue-resolved short code such as |
filters |
|
The optional .dataset block is a named list of agency,
prefix and/or version identity selectors, with the same meaning
as in oecdDataset. For example,
list(.dataset = list(agency = "OECD.SDD.STES"), REF_AREA = "USA").
These selectors choose a dataset and are removed before dimension filtering.
A selector-only block leaves all dimensions unrestricted. Conflicts with an
explicit reference are errors. The Filters result attribute retains the
original full list, including the selector block.
The structure is resolved before constructing the data query. Dimension names are matched case-insensitively; values must be valid literal codes with their original case. Leading zeros in identifiers are preserved. A single empty string selects all values of its dimension and produces a warning. Other missing or empty selections fail explicitly.
Common annual, quarterly, half-yearly, weekly, monthly and daily period formats
are supported: YYYY, YYYY-Q1, YYYY-S1, YYYY-W01,
YYYY-MM, and YYYY-MM-DD. Annual YYYY-A1 and monthly
YYYY-M01 aliases are normalized. Use one granularity in a filter.
Subdaily periods, custom calendars and mixed-granularity bounds are not supported.
The client downloads to disk and parses with data.table::fread. It does
not aggregate, infer seasonal adjustment, rescale units, translate flags, or fill
in a Cartesian product of missing observations. Duplicate observation keys,
delete actions, unexpected response identities and malformed values fail rather
than being silently repaired. HTTP 204 produces a typed empty result with a
warning; HTTP errors, including 404, remain errors.
A pinned structure version does not freeze historical statistical revisions. Save an RDS snapshot when an exact data vintage is required.
By default, a data.frame with classes OECDDataset and
data.frame. Dimension columns are factors, value_ is a double,
and flags_ contains the raw OBS_STATUS text, or an empty string if
that attribute is absent. All other supplied statistical attributes are retained.
Set return_data_table = TRUE for a data.table, and
strings_as_factors = FALSE for character dimensions.
Attributes include RequestedDatasetCode (input reference),
OECDDatasetCode (resolved exact reference), DownloadTime,
SourceURL, Cached, Dimensions, OECDAttributes,
and Filters. A cache hit preserves the original download time.
oecdDataset, oecdQuery, oecdStructure, importLabels, oecdOptions
x <- oecdExample()
names(x)
attr(x, "Dimensions")
if (interactive()) {
cli <- importData(OECDDatasetCode = "CLI",
filters = list(REF_AREA = c("USA", "FRA"), FREQ = "M",
TIME_PERIOD = c("2023-01", "2023-12")))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.