eia_category_query: Gets name and id for a single category, and also lists its...

Description Usage Arguments Details Author(s) Examples

Description

This function requests and returns data from the EIA API.

Usage

1
2
eia_category_query(category_id, api_key, format = "json",
  simplify = TRUE)

Arguments

category_id

A unique numerical ID of the EIA data category to fetch. If NULL, the API's root category is returned.

api_key

Required. A valid API key is required and may be obtained from EIA registration page (see details).

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 = FALSE to access 'xml' or 'json' formatted output.

simplify

Logical. If TRUE, the function returns data in a data frame. If FALSE, function returns data in specified output format.

Details

# Download category 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.

Author(s)

David Mitchell <david.pk.mitchell@gmail.com>

Examples

1
2
3
  
    eia_cat <- eia_category_query(api_key = "Your API Key")
  

mitcda/eiastats documentation built on May 8, 2019, 12:48 p.m.