Package 'intensegRid'

Title: R Wrapper for the Carbon Intensity API
Description: Electricity is not made equal and it vary in its carbon footprint (or carbon intensity) depending on its source. This package enables to access and query data provided by the Carbon Intensity API (<https://carbonintensity.org.uk/>). National Grid’s Carbon Intensity API provides an indicative trend of regional carbon intensity of the electricity system in Great Britain.
Authors: Kasia Kulma <[email protected]>
Maintainer: Kasia Kulma <[email protected]>
License: CC0
Version: 0.1.2
Built: 2024-10-29 04:47:01 UTC
Source: https://github.com/kkulma/intensegrid

Help Index


Tidy up intensity results column names

Description

Tidy up intensity results column names

Usage

clean_colnames(result)

Arguments

result

a data frame with raw results from Carbon Intensity API

Value

data frame


Fetch British carbon intensity data for specified time period

Description

Fetch British carbon intensity data for specified time period

Usage

get_british_ci(start = NULL, end = NULL)

Arguments

start

character A start date of the intesity.

end

character An end date of the intesity data. The maximum date range is limited to 14 days.

Value

a data.frame with 1/2-hourly carbon intensity data for specified time period

Examples

## Not run: 
get_british_ci()
get_british_ci(start = '2019-01-01', end = '2019-01-02')

## End(Not run)

Retrieve raw data from Carbon Intensity API

Description

Retrieve raw data from Carbon Intensity API

Usage

get_data(call)

Arguments

call

character API URL

Value

tibble


Get Carbon Intensity factors for each fuel type

Description

Get Carbon Intensity factors for each fuel type

Usage

get_factors()

Value

a tibble

Examples

get_factors()

Get generation mix for current half hour

Description

Get generation mix for current half hour

Usage

get_mix(start = NULL, end = NULL)

Arguments

start

character A start date of the intesity data

end

character An end date of the intesity data

Value

tibble

Examples

## Not run: 
start <- "2019-04-01"
end <- "2019-04-07"
get_mix(start, end)
get_mix()
## End(Not run)

Get Carbon Intensity data for current half hour for a specified GB Region

Description

Get Carbon Intensity data for current half hour for a specified GB Region

Usage

get_national_ci(start = NULL, end = NULL, region = NULL)

Arguments

start

character A start date of the intesity

end

character An end date of the intesity data

region

character The name of the GB region, one of 'England', 'Scotland' or 'Wales'

Value

a tibble

Examples

## Not run: 
get_national_ci()
get_national_ci(region = 'England')
get_national_ci(region = 'Scotland')
get_national_ci(region = 'Wales')
get_national_ci(start = '2019-01-01', end = '2019-01-02')

## End(Not run)

Get Carbon Intensity for specified postcode.

Description

Get Carbon Intensity for specified postcode.

Usage

get_postcode_ci(postcode, start = NULL, end = NULL)

Arguments

postcode

character Outward postcode i.e. RG41 or SW1 or TF8. Do not include full postcode, outward postcode only

start

character A start date of the intesity data

end

character An end date of the intesity data

Value

tibble

Examples

## Not run: 
get_postcode_ci(postcode = 'EN2')
get_postcode_ci(postcode = 'EN2', start = '2019-01-01', end = '2019-01-02')

## End(Not run)

Get Carbon Intensity data between specified datetimes for specified region

Description

Get Carbon Intensity data between specified datetimes for specified region

Usage

get_regional_ci(region_id, start = NULL, end = NULL)

Arguments

region_id

numeric Region ID in the UK region. See list of Region IDs in regions_lookup

start

character A start date of the intesity data

end

character An end date of the intesity data

Value

a tibble

Examples

## Not run: 
get_regional_ci(13)
get_regional_ci(13, start = '2019-01-02', end = '2019-01-03')

## End(Not run)

Get Carbon Intensity statistics between from and to dates

Description

Get Carbon Intensity statistics between from and to dates

Usage

get_stats(start, end, block = NULL)

Arguments

start

character A start date of the stats data. The maximum date range is limited to 30 days.

end

character An end date of the stats data. The maximum date range is limited to 30 days.

block

numeric Block length in hours i.e. a block length of 2 hrs over a 24 hr period returns 12 items with the average, max, min for each 2 hr block

Value

tibble

Examples

## Not run: 
start <- "2019-04-01"
end <- "2019-05-01"
get_stats(start, end)
get_stats(start, end, block = 2)

## End(Not run)

regions_lookup

Description

A lookup table of region_ids and corresponding GB regions

Usage

regions_lookup

Format

A data frame with 17 rows and 2 variables:

Region ID

region ID to be used in intensegRid package

Shortname

corresponding GB region

Source

https://carbon-intensity.github.io/api-definitions/#region-list