oecdOptions: Read or Set OECDdata Options

View source: R/options.R

oecdOptionsR Documentation

Read or Set OECDdata Options

Description

Read or Set OECDdata Options.

Usage

oecdOptions(...)

clearCache()

Arguments

...

Named option values without the OECDdata. prefix. With no arguments, return all current settings.

Details

All settings are ordinary R options prefixed with OECDdata..

api_version

"v2" by default; explicitly select "v1" for legacy routes.

base_url

"https://sdmx.oecd.org/public/rest". An HTTPS root ending in /rest, without /v2.

language

"en"; requested metadata language.

dataset

NULL; default context for labels and scoped metabase calls.

cache, cache_dir

TRUE, NULL; a session temporary directory unless explicitly configured.

cache_ttl, metadata_ttl

3600, 86400 seconds, respectively.

offline, refresh

Both FALSE. Offline accepts expired but verified entries. Refresh bypasses cache reuse online.

timeout, connect_timeout

120, 20 seconds.

retries, max_retry_wait

3, 60; retry count after the initial attempt and maximum allowed retry delay in seconds.

min_interval

1 second between requests in this session.

max_downloads, download_window

60, 3600; local rolling data-attempt budget. Retries count; metadata requests do not.

strings_as_factors, return_data_table

TRUE, FALSE; compatible default result types.

quiet, open_browser

FALSE, interactive(); suppress progress messages or control interactive reports.

availability

"actual"; use "allowed" only for explicitly requested dictionary-code inventories.

max_bytes

Inf; optional response-size limit in bytes.

HTTP Retry-After is respected. Delays above the configured maximum produce an error, never an early retry. A local budget cannot account for other sessions sharing an IP address. It is not a guarantee against service throttling.

Cache identities include URL, media type and language. Entries carry checksums, status and original download times. Only package-owned files are removed by clearCache. No shared-process locking or automatic eviction is provided; use a separate cache directory per concurrent writer. Checksums detect corruption but are not a substitute for trusting the configured local directory. The setter returns the prior namespaced settings invisibly. In a function, use old <- oecdOptions(...) and on.exit(options(old), add = TRUE) to restore them when leaving.

The size limit is enforced by libcurl when the server advertises a usable length and is checked after transfer and before returning a cached response as well. It is not an absolute bound on bytes received when a response has no advertised size.

Value

With no arguments, oecdOptions returns a named settings list. When setting options, it invisibly returns the previous, fully prefixed options, so options(old) restores them. clearCache invisibly returns the number of owned cache files removed, not the number of requests.

See Also

importData, importMetabase

Examples

old <- oecdOptions(quiet = TRUE, strings_as_factors = FALSE)
x <- oecdExample()
stopifnot(is.character(x$REF_AREA))
options(old)


OECDdata documentation built on Oct. 31, 2026, 1:07 a.m.