Description Usage Arguments Details Author(s) Examples
This function requests and returns data from the EIA API.
1 2 |
series_id |
Case-insensitive character vector of one or more EIA Series ID codes. The EIA Series ID (also called source key) is a case-insensitive string consisting of letters, numbers, dashes ("-") and periods (".") that uniquely identifies an EIA series. |
api_key |
Required. A valid API key is required and may be obtained from EIA registration page (see details). |
start_date |
Optional start date filter—if supplied, returns data after the specified start date. Argument accepts valid numeric, character, date or datetime format object. If numeric it must be in %Y form (i.e. four digit year). If character string, it must be in year-month-date (%Y-%m-%d) format. |
end_date |
Optional end date filter—if supplied, returns data up to and including the specified end date. Argument accepts valid numeric, character, date or datetime format object. If numeric it must be in %Y form (i.e. four digit year). If character string, it must be in year-month-date (%Y-%m-%d) format. |
num |
Number of values to be returns, to be used in conjunction with the |
format |
API return format. Valid values are 'xml' or 'json'. Default is for API to return
JSON formatted output. Note that it is also necessary to set |
simplify |
Logical. If |
# Download data from the EIA API
Users of the EIA API are required to obtain an API Key from the EIA Open Data registration page (https://www.eia.gov/opendata/register.php). A valid email address is required as part of the registration process.
Note that the number of series in a single request is limited to 100.
David Mitchell <david.pk.mitchell@gmail.com>
1 2 3 4 5 |
eia_data <- eia_series_query("STEO.BREPUUS.A"),
api_key = "Your API Key", num = 100, end_date = "2017-06-30",
format = "json")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.