Skip to contents

Finds the table's time dimension (years, quarters, months or dates) and lists its periods from oldest to newest.

Usage

nso_table_periods(tbl_id)

Arguments

tbl_id

Table identifier.

Value

A tibble with one row per period, oldest first, and columns code (the positional PXWeb code), label (as shown by NSO, e.g. "2024" or "2024-03"), date (first day of the period, see nso_period_date()) and frequency ("year", "quarter", "month" or "day"). Periods whose label is not a recognisable date keep their catalogue order at the end. The tibble has no rows when the table has no time dimension or in offline mode (see nso_offline_enable()). Unknown tables and failed requests raise an error.

Details

NSO codes periods by position: code "0" is the latest period, so a period's code changes whenever a new one is published. Use the label column (or nso_period_seq()) in selections, not code.

See also

nso_latest_periods() for the most recent periods.

Examples

if (FALSE) { # identical(Sys.getenv("NOT_CRAN"), "true") && curl::has_internet()
periods <- nso_table_periods("DT_NSO_0300_001V2")
tail(periods)
}