Learn R Programming

EIAdata (version 0.1.3)

getEIA: 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)

Examples

Run this code
# NOT RUN {
## 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)"))
  }
# }

Run the code above in your browser using DataLab