eia_series_metadata: EIA series metadata

Description Usage Arguments Details Value See Also Examples

View source: R/series.R

Description

Make a small request to obtain a data frame containing metadata.

Usage

1
2
3
4
5
6
7
8
9
eia_series_metadata(id, cache = TRUE, key = eia_get_key())

eia_series_updates(id, cache = TRUE, key = eia_get_key())

eia_series_dates(id, cache = TRUE, key = eia_get_key())

eia_series_range(id, cache = TRUE, key = eia_get_key())

eia_series_cats(id, tidy = TRUE, cache = TRUE, key = eia_get_key())

Arguments

id

character, series ID, may be a vector.

cache

logical, cache result for duration of R session using memoization.

key

API key: character if set explicitly; not needed if key is set globally. See eia_set_key.

tidy

logical, return a tidier result. See details.

Details

Dates are provided in eia_series_dates for the convenience of working with the EIA date string format; for example: maintaining order, generating sequences, computing intervals, and other operations that work well with dates but would be difficult using arbitrary strings. Keep in mind that of course these are not real dates, in the sense that you cannot map a year to a specific date.

eia_series_updates returns a data frame of most recent series update times for id. Like the other metadata helpers, this does require an API call to the series to obtain the relevant metadata. This can be useful if you are only interested in these update times for a specific set of series IDs. If you need to know the most recent update stamps for a large set of series, you should use eia_updates instead, which makes an API call specifically to the EIA updates endpoint for specific EIA categories by category ID.

eia_series_cats differs from the other functions in that it makes an API call directly to the series categories endpoint. Like other functions that return endpoint-specific output, it accepts the tidy argument for control over output structure. By default, additional processing is done to return a list containing tibble data frames. Set tidy = FALSE to return only the initial list result of jsonlite::fromJSON. Set tidy = NA to return the original JSON as a character string.

Value

a tibble data frame

See Also

eia_updates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# use eia_set_key() to store stored API key
id <- paste0("ELEC.CONS_TOT_BTU.COW-AK-1.", c("A", "Q", "M"))

eia_series_metadata(id)
eia_series_updates(id)
eia_series_dates(id)
eia_series_range(id)
eia_series_cats(id)

## End(Not run)

eia documentation built on Feb. 22, 2021, 9:09 a.m.