Package {aradR}


Type: Package
Title: Modern R Client and Toolkit for the Czech National Bank ARAD API
Version: 0.2.0
Description: Provides a reliability-first interface to the public Czech National Bank ARAD API for discovering indicators, browsing human-readable metadata, retrieving and validating time series, working with dimensions and snapshots, reshaping data, and building reproducible data workflows. The package is designed for robust handling of long requests, parsing diagnostics, missing values, retries, caching, and automated tests.
License: MIT + file LICENSE
Encoding: UTF-8
Language: en
Depends: R (≥ 4.1.0)
RoxygenNote: 7.3.2
Imports: curl, httr2 (≥ 0.2.2), readr, tibble
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
Config/Needs/website: r-lib/pkgdown
URL: https://simonamalovana.com/aradR/, https://github.com/simonamalovana/aradR
BugReports: https://github.com/simonamalovana/aradR/issues
NeedsCompilation: no
Packaged: 2026-10-04 20:35:53 UTC; runner
Author: Simona Malovana [aut, cre], Petr Bouchal ORCID iD [ctb]
Maintainer: Simona Malovana <simona.malovana@gmail.com>
Repository: CRAN
Date/Publication: 2026-10-15 16:50:02 UTC

Clear aradR response caches

Description

Clears raw ARAD API responses stored by aradR in the current R session and/or on disk.

Usage

arad_cache_clear(cache = c("all", "session", "disk"), cache_dir = NULL)

Arguments

cache

Which cache to clear: all, session, or disk.

cache_dir

Optional disk cache directory.

Value

Invisibly, TRUE.


Build an enriched catalogue of indicators within an ARAD scope

Description

Combines basic indicator metadata with hierarchy paths and optional availability metadata for human-facing browsing. Exactly one normal ARAD selector must be supplied.

Usage

arad_catalog(
  indicator_ids = NULL,
  set_id = NULL,
  base_id = NULL,
  selection_id = NULL,
  lang = c("cs", "en"),
  include_path = TRUE,
  include_availability = TRUE,
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

indicator_ids

Character vector of indicator IDs.

set_id

ARAD set ID.

base_id

ARAD base ID.

selection_id

ARAD user selection ID.

lang

Metadata language, "cs" or "en".

include_path

Include the ARAD hierarchy path for each indicator.

include_availability

Include earliest/latest availability boundaries, latest update timestamp and snapshot-context count. data_to is reported by ARAD and can extend into a forecast or reporting horizon; it is not necessarily the latest observed historical date.

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding.

cache

Response cache mode: none, session, or disk.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds.

Value

A tibble with one row per indicator in the selected scope.


List ARAD indicator dimensions

Description

Retrieves base and dimensional metadata from the ARAD indicators-dims endpoint. Exactly one ARAD scope selector must be supplied.

Usage

arad_dimensions(
  indicator_ids = NULL,
  set_id = NULL,
  base_id = NULL,
  selection_id = NULL,
  lang = c("cs", "en"),
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

indicator_ids

Character vector of indicator IDs.

set_id

ARAD set ID.

base_id

ARAD base ID.

selection_id

ARAD user selection ID.

lang

Metadata language: cs or en.

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding. Defaults to Windows-1250.

cache

Response cache mode: none, session, or disk.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds.

Value

A tibble describing each indicator's base and dimensions.


Find indicators using human-readable metadata

Description

Searches names, IDs and ARAD hierarchy paths and, by default, base/dimension metadata so a user does not need to know an indicator ID in advance. ARAD metadata endpoints remain scoped, so exactly one selector is required. Results are ordered deterministically: exact ID/name matches first, then partial ID/name matches, hierarchy-path matches and dimension matches, with stable name/ID tie-breaking.

Usage

arad_find(
  term,
  indicator_ids = NULL,
  set_id = NULL,
  base_id = NULL,
  selection_id = NULL,
  frequency = NULL,
  search_dimensions = TRUE,
  details = TRUE,
  regex = FALSE,
  ignore_case = TRUE,
  lang = c("cs", "en"),
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

term

Non-empty text or regular expression to search for.

indicator_ids

Character vector of indicator IDs.

set_id

ARAD set ID.

base_id

ARAD base ID.

selection_id

ARAD user selection ID.

frequency

Optional frequency code(s) to retain.

search_dimensions

Search base and dimension labels/codes as well as names, IDs and hierarchy paths.

details

Add availability/update columns for matched indicators. data_to is the ARAD-reported availability boundary and can extend into a forecast or reporting horizon; it is not necessarily the latest observed historical date.

regex

Interpret term as a regular expression.

ignore_case

Ignore case while matching.

lang

Metadata language, "cs" or "en".

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding.

cache

Response cache mode: none, session, or disk.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds.

Value

A filtered, path-aware indicator catalogue ordered by relevance. relevance_score is an ordinal score intended only to order results for the current query, and matched_in records which metadata sources matched. With details = TRUE, availability columns are included.


Retrieve time series from ARAD

Description

Reliability-first retrieval of ARAD time series. Exactly one selector must be supplied. With strategy = "auto", long date ranges are split into deterministic, non-overlapping chunks; omitted boundaries are resolved through the ARAD updates endpoint. Optional raw-response caching is explicit and disabled by default.

Usage

arad_get(
  indicator_ids = NULL,
  set_id = NULL,
  base_id = NULL,
  selection_id = NULL,
  from = NULL,
  to = NULL,
  months_before = NULL,
  snapshot_ids = NULL,
  strategy = c("auto", "direct"),
  chunk_days = getOption("aradR.chunk_days", 3650L),
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

indicator_ids

Character vector of indicator IDs.

set_id

ARAD set ID.

base_id

ARAD base ID.

selection_id

ARAD user selection ID.

from

Start date as a Date, YYYY-MM-DD, or YYYYMMDD.

to

End date as a Date, YYYY-MM-DD, or YYYYMMDD.

months_before

Optional positive integer; an ARAD-native alternative to from/to.

snapshot_ids

Optional snapshot IDs, or ALL / LAST.

strategy

Retrieval strategy. auto uses bounded requests; direct makes one data request.

chunk_days

Maximum inclusive date span of each automatic chunk. The 3650-day default is calibrated by the package's live reliability audit.

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding. Defaults to Windows-1250.

cache

Response cache mode: none, session, or disk. NULL uses the aradR.cache option, defaulting to none.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds. NULL uses the aradR.cache_max_age option, defaulting to Inf.

Value

A tibble with columns indicator_id, snapshot_id, period, and value. Retrieval diagnostics are stored in the arad_diagnostics attribute.


List ARAD indicators and basic metadata

Description

Retrieves basic metadata from the ARAD indicators endpoint. Exactly one ARAD scope selector must be supplied.

Usage

arad_indicators(
  indicator_ids = NULL,
  set_id = NULL,
  base_id = NULL,
  selection_id = NULL,
  lang = c("cs", "en"),
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

indicator_ids

Character vector of indicator IDs.

set_id

ARAD set ID.

base_id

ARAD base ID.

selection_id

ARAD user selection ID.

lang

Metadata language: cs or en.

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding. Defaults to Windows-1250.

cache

Response cache mode: none, session, or disk.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds.

Value

A tibble with indicator ID, name, frequency, scaling and unit metadata.


Inspect selected ARAD indicators in detail

Description

Retrieves a compact path/availability summary plus detailed dimension metadata and raw update rows for candidate indicators selected through discovery.

Usage

arad_info(
  indicator_ids,
  lang = c("cs", "en"),
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

indicator_ids

Character vector of indicator IDs to inspect.

lang

Metadata language, "cs" or "en".

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding.

cache

Response cache mode: none, session, or disk.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds.

Value

A named list with summary, dimensions, and updates tibbles. Availability dates in summary are boundaries reported by ARAD; data_to can include future forecast or reporting horizons.


Description

Searches indicator IDs and names returned by the ARAD indicators endpoint. Because ARAD does not expose an unscoped global indicator list through this endpoint, exactly one normal ARAD selector is required.

Usage

arad_search(
  term,
  indicator_ids = NULL,
  set_id = NULL,
  base_id = NULL,
  selection_id = NULL,
  frequency = NULL,
  regex = FALSE,
  ignore_case = TRUE,
  lang = c("cs", "en"),
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

term

Non-empty search text or regular expression.

indicator_ids

Character vector of indicator IDs.

set_id

ARAD set ID.

base_id

ARAD base ID.

selection_id

ARAD user selection ID.

frequency

Optional frequency code(s) to retain.

regex

Interpret term as a regular expression.

ignore_case

Ignore case while matching.

lang

Metadata language: cs or en.

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding. Defaults to Windows-1250.

cache

Response cache mode: none, session, or disk.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds.

Value

A filtered indicator metadata tibble.


List available ARAD snapshots

Description

Retrieves the list of ARAD snapshots. Unlike the indicator metadata endpoints, this service does not require an ARAD scope selector.

Usage

arad_snapshots(
  lang = c("cs", "en"),
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

lang

Metadata language: cs or en.

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding. Defaults to Windows-1250.

cache

Response cache mode: none, session, or disk.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds.

Value

A tibble with snapshot_id and snapshot_name.


List ARAD indicator tree paths

Description

Retrieves indicator placement in the ARAD metadata tree. Exactly one ARAD scope selector must be supplied.

Usage

arad_tree(
  indicator_ids = NULL,
  set_id = NULL,
  base_id = NULL,
  selection_id = NULL,
  lang = c("cs", "en"),
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

indicator_ids

Character vector of indicator IDs.

set_id

ARAD set ID.

base_id

ARAD base ID.

selection_id

ARAD user selection ID.

lang

Metadata language: cs or en.

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding. Defaults to Windows-1250.

cache

Response cache mode: none, session, or disk.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds.

Value

A tibble with indicator_id and ARAD tree path.


Retrieve ARAD update metadata

Description

Retrieves the last update timestamp and available data boundaries from the ARAD updates endpoint. Exactly one selector must be supplied.

Usage

arad_updates(
  indicator_ids = NULL,
  set_id = NULL,
  base_id = NULL,
  selection_id = NULL,
  snapshot_ids = NULL,
  api_key = NULL,
  base_url = NULL,
  encoding = "windows-1250",
  cache = NULL,
  cache_dir = NULL,
  cache_max_age = NULL
)

Arguments

indicator_ids

Character vector of indicator IDs.

set_id

ARAD set ID.

base_id

ARAD base ID.

selection_id

ARAD user selection ID.

snapshot_ids

Optional snapshot IDs, or ALL / LAST.

api_key

ARAD API key. If NULL, ARAD_API_KEY is used.

base_url

ARAD API base URL. Primarily intended for testing.

encoding

Response encoding. Defaults to Windows-1250.

cache

Response cache mode: none, session, or disk. NULL uses the aradR.cache option, defaulting to none.

cache_dir

Optional disk cache directory.

cache_max_age

Maximum cache age in seconds. NULL uses the aradR.cache_max_age option, defaulting to Inf.

Value

A tibble with indicator_id, snapshot_id, update_date, data_from, and data_to.


Reshape ARAD data to wide format

Description

Converts the long-format output of arad_get() into one row per period and one column per series. Snapshot identifiers are incorporated into column names automatically when they are needed to distinguish multiple snapshot contexts for the same indicator.

Usage

arad_wide(
  data,
  snapshot = c("auto", "include", "ignore"),
  names_sep = "__"
)

Arguments

data

A data frame with indicator_id, period, and value columns, typically returned by arad_get().

snapshot

How snapshot identifiers should affect column names: "auto" adds them only when an indicator has multiple snapshot contexts, "include" always adds them, and "ignore" never adds them.

names_sep

Separator used between indicator and snapshot identifiers.

Value

A tibble with one period column and one numeric column per series. The arad_diagnostics attribute is preserved when present on data.