Last data update: 2014.03.03

R: R wrapper for the US Energy Information Administration's...
EIAdata-packageR Documentation

R wrapper for the US Energy Information Administration's (EIA's) API.

Description

This package allows the user to query categories, and import data, through the EIA's API. Resulting time series are objects of class xts. The EIA API offeres access to over a million unique time series.

Details

Package: EIAdata
Type: Package
Version: 0.0.3
Date: 2015-03-09
License: GPL-2

Author(s)

Matthew Brigida

Maintainer: Matthew Brigida <matt@complete-markets.com>

References

http://www.eia.gov/beta/api/

Examples


# donttest is used here because the functions require a valid EIA API key.
# While API keys are free, they are best kept private.

# Be sure to load your EIA key.  You can request one
# here: http://www.eia.gov/beta/api/register.cfm

key <- "your_key"

# To see the top of the data category hierarchy.

getCatEIA(key=key)

# To see the subcategories and data sets in a particular category (for example 40827).

getCatEIA(key=key, cat=40827)

# To download and return a time series object of class xts
# for example ELEC.PLANT.GEN.13-WAT-ALL.Q

getQEIA(ID = "ELEC.PLANT.GEN.13-WAT-ALL.Q", key = key)

# The if the EIA series ID contains a "-", the function will replace
# this with a ".".  So the call above will return a time series of
# class xts named ELEC.PLANT.GEN.13.WAT.ALL.Q

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(EIAdata)
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

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EIAdata/EIAdata-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: EIAdata-package
> ### Title: R wrapper for the US Energy Information Administration's (EIA's)
> ###   API.
> ### Aliases: EIAdata-package EIAdata
> ### Keywords: EIAdata
> 
> ### ** Examples
> 
> ## No test: 
> # donttest is used here because the functions require a valid EIA API key.
> # While API keys are free, they are best kept private.
> 
> # Be sure to load your EIA key.  You can request one
> # here: http://www.eia.gov/beta/api/register.cfm
> 
> key <- "your_key"
> 
> # To see the top of the data category hierarchy.
> 
> getCatEIA(key=key)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function 'xmlToDataFrame' for signature '"missing", "missing", "missing", "missing", "NULL"'
Calls: getCatEIA -> xmlToDataFrame -> <Anonymous>
Execution halted