Skip to content

Automated Shiny app to display weekly U.S. gas prices

License

Notifications You must be signed in to change notification settings

kcuilla/USgasprices

Repository files navigation

U.S. Gas Prices Visualized

The U.S. Gas Prices app displays the latest weekly gas prices from major cities across the U.S.. The data is pulled automatically from the U.S. Energy Information Administration's weekly gas update.

About the data

The data is sourced from the U.S. Energy Information Administration (EIA). At the start of each week, the EIA updates the average prices for regular, midgrade, and premium retail gas. The data is available for a handful of cities across the U.S., as well as the overall average for the U.S..

This data is accessible via EIA's API. I used the {eia} package is used to connect to the API and pull the data in a tidy format.

Automatic updating

The data is updated every Tuesday evening after the EIA refreshes the data on their site. This is done automatically via GitHub Actions. Once the new data is pulled, the visualizations and text are refreshed and the updated app is automatically deployed to shinyapps.io. The script for the GitHub Actions workflow can be found here.

Shiny app

The framework for this Shiny app was made using the {golem} package and displayed using the {fullPage} package by John Coene.

A huge thank you to John for creating many packages that are used for this app, including the aforementioned {fullPage} package and {typedjs}. This app was also largely inspired by John's Freedom of the Press app which can be found in RStudio's Shiny Gallery.

The packages used to create the visualizations include {highcharter}, {ggiraph}, and {reactablefmtr}.

An example of the user-interactivity features can be seen below:

Mobile & Desktop friendly

The site is optimized for viewing on both mobile and desktop devices. I used the {shinybrowser} package to detect the user's device and display the visuals so that they optimally fit on the user's device.

Mobile Desktop

About

Automated Shiny app to display weekly U.S. gas prices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published