The UK National Electricity Transmission System Dataset

Intro

The UKgrid is an R dataset package with the historical national demand of the electricity transmission system in the UK and other related variables. This dataset is a half-hourly time series data with observations since April 2005. This dataset was sourced from National Grid UK website.

Installation

Install the package from CRAN:

or install the development version from Github:

# install.packages("remotes")
remotes::install_github("RamiKrispin/UKgrid")

Usage

library(UKgrid)

data("UKgrid")

str(UKgrid)
#> 'data.frame':    254592 obs. of  9 variables:
#>  $ TIMESTAMP                : POSIXct, format: "2005-04-01 00:00:00" "2005-04-01 00:30:00" ...
#>  $ ND                       : int  32926 32154 33633 34574 34720 34452 33818 32951 32448 32212 ...
#>  $ I014_ND                  : int  32774 32032 33495 34460 34641 34347 33854 33020 32525 32287 ...
#>  $ TSD                      : int  34286 33885 35082 36028 36179 35921 35362 34607 34347 34103 ...
#>  $ ENGLAND_WALES_DEMAND     : int  29566 28871 30340 31253 31325 31094 30442 29664 29167 28920 ...
#>  $ EMBEDDED_WIND_GENERATION : int  0 0 0 0 0 0 0 0 0 0 ...
#>  $ EMBEDDED_WIND_CAPACITY   : int  0 0 0 0 0 0 0 0 0 0 ...
#>  $ EMBEDDED_SOLAR_GENERATION: int  0 0 0 0 0 0 0 0 0 0 ...
#>  $ EMBEDDED_SOLAR_CAPACITY  : int  0 0 0 0 0 0 0 0 0 0 ...

A variable dictionary is available in the dataset documentation.

The extract_grid function

The extract_grid function provides the ability to extract the UKgrid series in a different format (tsibble, xts, zoo, ts, data.frame, data.table and tbl), frequencies (half-hourly, hourly, daily, weekly, monthly and quarterly), and subset the series by time frame.

For example, you can select the national demand variable (ND), using tsibble format:


nd_half_hourly <- extract_grid(type = "tsibble", # default
                          columns = "ND", # default
                          aggregate = NULL # default
                          )



library(tsibble)

head(nd_half_hourly)
#> # A tsibble: 6 x 2 [30m] <UTC>
#>   TIMESTAMP              ND
#>   <dttm>              <int>
#> 1 2005-04-01 00:00:00 32926
#> 2 2005-04-01 00:30:00 32154
#> 3 2005-04-01 01:00:00 33633
#> 4 2005-04-01 01:30:00 34574
#> 5 2005-04-01 02:00:00 34720
#> 6 2005-04-01 02:30:00 34452

class(nd_half_hourly)
#> [1] "tbl_ts"     "tbl_df"     "tbl"        "data.frame"

index(nd_half_hourly)
#> TIMESTAMP

interval(nd_half_hourly)
#> <interval[1]>
#> [1] 30m

library(TSstudio)

ts_plot(ts.obj = nd_half_hourly,
        title = "UK National Demand - Half-Hourly")