Skip to contents

Discovers the years currently published for the dataset by reading the CVM open-data directory listing. Returns an integer vector (sorted, no gaps assumed). Caches the result for the duration of the R session to avoid repeated HTTP calls.

Usage

cvm_dataset_years(dataset, group = NULL, schema = NULL)

Arguments

dataset

Short dataset id.

group

Optional CKAN group slug (e.g. "companhias"). When NULL (default) resolved by uniqueness across the installed schema tree; when a dataset slug occurs in more than one group, omitting group aborts with cvmdata_error_input_ambiguous.

schema

Optional already-loaded schema (used internally by issuer_fetch() to avoid double-load). Users typically omit.

Value

An integer vector of available years, or NA_integer_.

Details

Returns NA_integer_ for datasets whose tables are not yearly-partitioned (e.g. cad).

Examples

if (FALSE) { # interactive()
cvm_dataset_years("dfp")
cvm_dataset_years("dfp", group = "companhias")
}