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 |
Tidy up intensity results column names
clean_colnames(result)
clean_colnames(result)
result |
a data frame with raw results from Carbon Intensity API |
data frame
Fetch British carbon intensity data for specified time period
get_british_ci(start = NULL, end = NULL)
get_british_ci(start = NULL, end = NULL)
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. |
a data.frame with 1/2-hourly carbon intensity data for specified time period
## Not run: get_british_ci() get_british_ci(start = '2019-01-01', end = '2019-01-02') ## End(Not run)
## 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
get_data(call)
get_data(call)
call |
character API URL |
tibble
Get Carbon Intensity factors for each fuel type
get_factors()
get_factors()
a tibble
get_factors()
get_factors()
Get generation mix for current half hour
get_mix(start = NULL, end = NULL)
get_mix(start = NULL, end = NULL)
start |
character A start date of the intesity data |
end |
character An end date of the intesity data |
tibble
## Not run: start <- "2019-04-01" end <- "2019-04-07" get_mix(start, end) get_mix() ## End(Not run)
## 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
get_national_ci(start = NULL, end = NULL, region = NULL)
get_national_ci(start = NULL, end = NULL, region = NULL)
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' |
a tibble
## 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)
## 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.
get_postcode_ci(postcode, start = NULL, end = NULL)
get_postcode_ci(postcode, start = NULL, end = NULL)
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 |
tibble
## Not run: get_postcode_ci(postcode = 'EN2') get_postcode_ci(postcode = 'EN2', start = '2019-01-01', end = '2019-01-02') ## End(Not run)
## 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
get_regional_ci(region_id, start = NULL, end = NULL)
get_regional_ci(region_id, start = NULL, end = NULL)
region_id |
numeric Region ID in the UK region. See list of Region IDs in |
start |
character A start date of the intesity data |
end |
character An end date of the intesity data |
a tibble
## Not run: get_regional_ci(13) get_regional_ci(13, start = '2019-01-02', end = '2019-01-03') ## End(Not run)
## 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
get_stats(start, end, block = NULL)
get_stats(start, end, block = NULL)
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 |
tibble
## Not run: start <- "2019-04-01" end <- "2019-05-01" get_stats(start, end) get_stats(start, end, block = 2) ## End(Not run)
## Not run: start <- "2019-04-01" end <- "2019-05-01" get_stats(start, end) get_stats(start, end, block = 2) ## End(Not run)
A lookup table of region_ids and corresponding GB regions
regions_lookup
regions_lookup
A data frame with 17 rows and 2 variables:
Region ID
region ID to be used in intensegRid package
Shortname
corresponding GB region
https://carbon-intensity.github.io/api-definitions/#region-list