getEIA: A function to download data from the Energy Information...

View source: R/source.R

getEIAR Documentation

A function to download data from the Energy Information Administration's (EIA's) API.

Description

A function to download data from the EIA's API. Resulting time series are of class xts.

Usage

getEIA(ID, key)

Arguments

ID

The EIA API Series ID for the data.

key

Your EIA API key.

Value

xts object (time series)

Author(s)

Matthew Brigida

Examples

## The function is currently defined as
function (ID, key) 
{
    switch(.last_char(ID), A = .getAnnEIA(ID, key = key), Q = .getQEIA(ID, 
        key = key), M = .getMonEIA(ID, key = key), W = .getWDEIA(ID, 
        key = key), D = .getWDEIA(ID, key = key),
        print("ERROR: The last
        character of your ID is not one of the possible sampling
        frequencies (A, Q, M, W, or D)"))
  }

EIAdata documentation built on March 18, 2022, 7:14 p.m.