knitr::opts_chunk$set(collapse=TRUE, comment="#>")
NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true")
knitr::opts_chunk$set(purl = NOT_CRAN)
## Use `eval = NOT_CRAN` in any chunk that requires access to a secret.
## See https://cran.r-project.org/web/packages/httr/vignettes/secrets.html
##  for further details.

Introduction

The eiastats package provides access to data from the United States' Energy Information Administration (EIA).

## This code works - consider leaving this for users to extract relevant data
## Will deliver efficiencies, by first filtering before mapping and unnesting
w <- z %>%
  mutate(data = map(data,
                    ~ .x %>% as_tibble(data, .name_repair="unique") %>%
                      set_names(c("period","value"))
                    ))
y <- tidyr::unnest(w, data)
## This code works - consider leaving this for users to extract relevant data
## Will deliver efficiencies, by first filtering before mapping and unnesting
w <- z %>%
  mutate(data = map(data,
                    ~ .x %>% as_tibble(data, .name_repair="unique") %>%
                      set_names(c("period","value"))
                    ))
y <- tidyr::unnest(w, data)

Managing API keys

I use the secret package for managing the EIA API key.

To use these ...



mitcda/eiastats documentation built on May 8, 2019, 12:48 p.m.