{"id":13722245,"url":"https://github.com/ropensci/eia","last_synced_at":"2025-10-22T05:52:38.608Z","repository":{"id":41092084,"uuid":"193949063","full_name":"ropensci/eia","owner":"ropensci","description":"An R package wrapping the US Energy Information Administration open data API.","archived":false,"fork":false,"pushed_at":"2025-06-20T19:26:52.000Z","size":1441,"stargazers_count":48,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-17T00:59:12.601Z","etag":null,"topics":["cran","eia","eia-api","energy-data","energy-information-administration","open-data","r-package"],"latest_commit_sha":null,"homepage":"https://docs.ropensci.org/eia","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ropensci.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null}},"created_at":"2019-06-26T17:24:27.000Z","updated_at":"2025-10-06T09:28:10.000Z","dependencies_parsed_at":"2024-04-15T15:05:34.201Z","dependency_job_id":"cbb918d1-3dee-4f67-bf2a-e3434713746a","html_url":"https://github.com/ropensci/eia","commit_stats":{"total_commits":293,"total_committers":6,"mean_commits":"48.833333333333336","dds":0.4539249146757679,"last_synced_commit":"31104abb438cc421dd5dd40b9ba9a2bee1a24372"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/ropensci/eia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Feia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Feia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Feia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Feia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","download_url":"https://codeload.github.com/ropensci/eia/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Feia/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280389295,"owners_count":26322507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cran","eia","eia-api","energy-data","energy-information-administration","open-data","r-package"],"created_at":"2024-08-03T01:01:26.375Z","updated_at":"2025-10-22T05:52:38.558Z","avatar_url":"https://github.com/ropensci.png","language":"R","funding_links":[],"categories":["R","Energy Systems","Datasets on Electricity Consumption and Generation"],"sub_categories":["Energy Data Accessibility and Integration","Monitoring and Control"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE, comment = \"#\u003e\", out.width = \"100%\",\n  fig.path = \"man/figures/README-\", fig.width = 7, fig.height = 4, dpi = 150,\n  message = FALSE, warning = FALSE, error = FALSE\n)\nlibrary(eia)\nlibrary(ggplot2)\n```\n\n# eia \u003cimg src=\"man/figures/logo.png\" style=\"margin-left:10px;margin-bottom:5px;\" width=\"120\" align=\"right\"\u003e\n\n\u003c!-- badges: start --\u003e\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)\n[![R-CMD-check](https://github.com/ropensci/eia/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/eia/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/ropensci/eia/branch/master/graph/badge.svg)](https://app.codecov.io/gh/ropensci/eia?branch=master)\n[![](https://badges.ropensci.org/342_status.svg)](https://github.com/ropensci/software-review/issues/342)\n[![CRAN status](https://www.r-pkg.org/badges/version/eia)](https://cran.r-project.org/package=eia)\n[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/eia)](https://cran.r-project.org/package=eia)\n[![Github Stars](https://img.shields.io/github/stars/ropensci/eia.svg?style=social\u0026label=Github)](https://github.com/ropensci/eia)\n\u003c!-- badges: end --\u003e\n\nThe `eia` package provides API access to data from the US [Energy Information Administration](https://www.eia.gov/) (EIA).\n\nPulling data from the US Energy Information Administration (EIA) API requires a registered API key.\nA key can be obtained at no cost [here](https://www.eia.gov/opendata/register.php).\nA valid email and agreement to the API Terms of Service is required to obtain a key.\n\n`eia` includes functions for searching the EIA API data directory and importing various datasets.\nDatasets returned by these functions are provided in a tidy format or alternatively in more raw form.\nIt also offers helper functions for working with EIA API date strings and time formats and for\ninspecting different summaries of data metadata. The package also provides control over API key\nstorage and caching of API request results.\n\n## Installation\n\nInstall the CRAN release of `eia` with\n\n```{r instl1, eval=FALSE}\ninstall.packages(\"eia\")\n```\n\nor install the development version from GitHub with\n\n```{r instl2, eval=FALSE}\n# install.packages(\"remotes\")\nremotes::install_github(\"ropensci/eia\")\n```\n\n## Example\n\nAfter obtaining the API key, store it somewhere such as `.Renviron` and never have\nto do anything with the key when using the package. Alternatively, set it manually\nwith `eia_set_key()` in the current R session. Further, it can always be passed\nexplicitly to the `key` argument of a given `eia` function.\n\n### Load package and set key\n\n```{r xmpl1, eval=FALSE}\nlibrary(eia)\n\n# not run\neia_set_key(\"yourkey\") # set API key if not already set globally\n```\n\n### Explore the API directory\n\nGet a list of the EIA's data directory (and sub-directories) with `eia_dir()`.\n\n```{r xmpl2}\n# Top-level directory\neia_dir()\n\n# Electricity sub-directory\neia_dir(\"electricity\")\n```\n\n### Get data\n\nGet annual retail electric sales for the Ohio residential sector since 2010\n\n```{r xmpl3}\n(d \u003c- eia_data(\n  dir = \"electricity/retail-sales\",\n  data = \"sales\",\n  facets = list(stateid = \"OH\", sectorid = \"RES\"),\n  freq = \"annual\",\n  start = \"2010\",\n  sort = list(cols = \"period\", order = \"asc\"),\n))\n```\n\nand make a nice plot.\n\n```{r plt}\nlibrary(ggplot2)\nggplot(d, aes(x = period, y = sales / 1e3)) +\n  geom_bar(col = \"steelblue\", fill = \"steelblue\", stat = \"identity\") +\n  theme_bw() +\n  labs(\n    title = \"Annual Retail Sales of Electricity (GWh)\",\n    subtitle = \"State: Ohio; Sector: Residential\",\n    x = \"Year\", y = \"Sales (GWh)\"\n  )\n```\n\n## References\n\nSee the collection of vignette tutorials and examples as well as complete package\ndocumentation available at the `eia` package [website](https://docs.ropensci.org/eia/).\n\n---\n\nPlease note that the `eia` project is released with\na [Contributor Code of Conduct](https://github.com/ropensci/eia/blob/master/CODE_OF_CONDUCT.md).\nBy contributing to this project, you agree to abide by its terms.\n\n[![ropensci_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Feia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropensci%2Feia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Feia/lists"}