MyNixOS website logo
Description

The Demand for Natural Gas in the US.

Provides an overview of the demand for natural gas in the US by state and country level. Data source: US Energy Information Administration <https://www.eia.gov/>.

USgas

CRAN_Status_Badge lifecycle License:MIT GitHubcommit

The USgas package provides an overview of demand for natural gas in the US in a time-series format. That includes the following dataset:

  • usgas - The monthly consumption of natural gas in the US/state level by end-use since 1973 for US level and 1989 for state level. It includes the following end-use categories:

    • Commercial Consumption
    • Delivered to Consumers
    • Electric Power Consumption
    • Industrial Consumption
    • Lease and Plant Fuel Consumption
    • Pipeline Fuel Consumption
    • Residential Consumption
    • Vehicle Fuel Consumption

The package also includes the following datasets, from previous release:

  • us_total - The US annual natural gas consumption by state-level between 1997 and 2019, and aggregate level between 1949 and 2019
  • us_monthly - The monthly demand for natural gas in the US between 2001 and 2020
  • us_residential - The US monthly natural gas residential consumption by state and aggregate level between 1989 and 2020

The us_total, us_monthly, and us_residential can be derived out of the usgas dataset. Therefore, those datasets in the process of deprication and will be removed in the next release to CRAN.

Data source: The US Energy Information Administration API

More information about the package datasets available on this vignette.

Installation

You can install the released version of USgas from CRAN with:

install.packages("USgas")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("RamiKrispin/USgas")

Example

Let’s load the data:

data("usgas")

head(usgas)
#>         date                 process state state_abb      y
#> 1 1973-01-01  Commercial Consumption  U.S.      U.S. 392315
#> 2 1973-01-01 Residential Consumption  U.S.      U.S. 843900
#> 3 1973-02-01  Commercial Consumption  U.S.      U.S. 394281
#> 4 1973-02-01 Residential Consumption  U.S.      U.S. 747331
#> 5 1973-03-01  Commercial Consumption  U.S.      U.S. 310799
#> 6 1973-03-01 Residential Consumption  U.S.      U.S. 648504

str(usgas)
#> 'data.frame':    92783 obs. of  5 variables:
#>  $ date     : Date, format: "1973-01-01" "1973-01-01" ...
#>  $ process  : chr  "Commercial Consumption" "Residential Consumption" "Commercial Consumption" "Residential Consumption" ...
#>  $ state    : chr  "U.S." "U.S." "U.S." "U.S." ...
#>  $ state_abb: chr  "U.S." "U.S." "U.S." "U.S." ...
#>  $ y        : int  392315 843900 394281 747331 310799 648504 231943 465867 174258 326313 ...
#>  - attr(*, "units")= chr "MMCF"
#>  - attr(*, "product_name")= chr "Natural Gas"
#>  - attr(*, "source")= chr "EIA API: https://www.eia.gov/opendata/browser/natural-gas"

Plotting the residential consumption of natural gas in the US:

library(plotly)

us_res <- usgas[which(usgas$state == "U.S." & usgas$process == "Residential Consumption"), ]

plot_ly(data = us_res,
        x = ~ date,
        y = ~ y,
        type = "scatter",
        mode = "line") |>
  layout(title = "US Monthly Residential Consumption",
         yaxis = list(title = "MMCF"),
         xaxis = list(title = "Source: EIA API"))

Plotting the total monthly natural gas delivered in the New England states:

ne <- c("Connecticut", "Maine", "Massachusetts",
        "New Hampshire", "Rhode Island", "Vermont")
ne_gas <-  usgas[which(usgas$state %in% ne & usgas$process == "Delivered to Consumers"),]

plot_ly(data = ne_gas,
        x = ~ date,
        y = ~ y,
        color = ~ state,
        type = "scatter",
        mode = "line") |>
  layout(title = "Total Natrual Gas Delivered to Consumers in New England States",
         yaxis = list(title = "MMCF"),
         xaxis = list(title = "Source: EIA API"))
Metadata

Version

0.1.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows