Description Usage Arguments Details Value See Also Examples
Make a small request to obtain a data frame containing metadata.
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())
|
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 |
tidy |
logical, return a tidier result. See 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.
a tibble data frame
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.