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

Description Usage Arguments Value Author(s) Examples

View source: R/source.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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)"))
  }

Example output

Loading required package: XML
Loading required package: plyr
Loading required package: xts
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

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\n        character of your ID is not one of the possible sampling\n        frequencies (A, Q, M, W, or D)"))
}

EIAdata documentation built on May 30, 2017, 4:26 a.m.