eia_series: EIA API Series Query

Description Usage Arguments Value Examples

View source: R/eia.R

Description

A function to pull a series from the eia API based on series ID

Usage

1
eia_series(api_key, series_id)

Arguments

api_key

A character, the user API key for the eia website

series_id

A character, the series ID as defined in the eia API, to query for the available series IDs use the eia_query function

Value

A list, with the series metadata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# Set you eia API key
api_key <- "Set you API key"

# Querying the eia API to get possible categories
eia_query(api_key = api_key) # getting the full list of categories
eia_query(api_key = api_key, category_id = "0") # querying the Electricity category
childseries <- eia_query(api_key = api_key, category_id = "1") # querying the Electricity Net Generation child series
series_id <- childseries$category$childseries$series_id[1] # pulling the first series ID from the list of Net Generation series

# Pulling the series from the eia API
raw_series <- eia_series(api_key = api_key, series_id = series_id)

## End(Not run)

RamiKrispin/tsAPI documentation built on Dec. 2, 2019, 11:43 p.m.