Title: | Interacts with REE and ESIOS API |
---|---|
Description: | Provides functions to retrieve and use easily data from Red Electrica Española (REE) the which operates the national electricity grid in Spain. The REE also provides ESIOS from electronic-"Sistema de Información del Operador del Sistema", which is also covered here. |
Authors: | Lluís Revilla Sancho [aut, cre] |
Maintainer: | Lluís Revilla Sancho <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0.9003 |
Built: | 2024-11-15 02:50:14 UTC |
Source: | https://github.com/rOpenSpain/resios |
Check which archives are available.
esios_archives()
esios_archives()
A data.frame with the information of what is available and where.
archives <- esios_archives() head(archives)
archives <- esios_archives() head(archives)
Retrieve the information of any indicator based on the id.
esios_indicators( indicator, locale = NULL, datetime = NULL, start_date = NULL, end_date = NULL, time_agg = NULL, time_trunc = NULL, geo_agg = NULL, geo_ids = NULL, geo_trunc = NULL )
esios_indicators( indicator, locale = NULL, datetime = NULL, start_date = NULL, end_date = NULL, time_agg = NULL, time_trunc = NULL, geo_agg = NULL, geo_ids = NULL, geo_trunc = NULL )
indicator |
ID code for an indicator |
locale |
Get translations for sources (es, en). Default language: es |
datetime |
A certain date to filter values by (iso8601 format) |
start_date |
Beginning of the date range to filter indicator values (iso8601 format) |
end_date |
End of the date range to filter indicator values (iso8601 format) |
time_agg |
How to aggregate indicator values when grouping them by time. Accepted values: 'sum', 'average'. Default value: 'sum'. |
time_trunc |
Tells the API how to trunc data time series. Accepted values: 'five_minutes', 'ten_minutes', 'fifteen_minutes', 'hour', 'day', 'month', 'year'. |
geo_agg |
How to aggregate indicator values when grouping them by geo_id. Accepted values: 'sum', 'average'. Default value: 'sum'. |
geo_ids |
Tells the API the geo ids to filter the date. |
geo_trunc |
Tells the API how to group data at geolocalization level when the geo_agg is informed. Accepted values: 'country', 'electric_system', 'autonomous_community', 'province', 'electric_subsystem', 'town' and 'drainage_basin'. |
ei10001 <- esios_indicators(10001) head(ei10001)
ei10001 <- esios_indicators(10001) head(ei10001)
This is a shortcut for esios_indicators("1001")
with some parsing.
esios_pvpc( locale = NULL, datetime = NULL, start_date = NULL, end_date = NULL, time_agg = NULL, time_trunc = NULL, geo_agg = NULL, geo_ids = NULL, geo_trunc = NULL )
esios_pvpc( locale = NULL, datetime = NULL, start_date = NULL, end_date = NULL, time_agg = NULL, time_trunc = NULL, geo_agg = NULL, geo_ids = NULL, geo_trunc = NULL )
locale |
Get translations for sources (es, en). Default language: es |
datetime |
A certain date to filter values by (iso8601 format) |
start_date |
Beginning of the date range to filter indicator values (iso8601 format) |
end_date |
End of the date range to filter indicator values (iso8601 format) |
time_agg |
How to aggregate indicator values when grouping them by time. Accepted values: 'sum', 'average'. Default value: 'sum'. |
time_trunc |
Tells the API how to trunc data time series. Accepted values: 'five_minutes', 'ten_minutes', 'fifteen_minutes', 'hour', 'day', 'month', 'year'. |
geo_agg |
How to aggregate indicator values when grouping them by geo_id. Accepted values: 'sum', 'average'. Default value: 'sum'. |
geo_ids |
Tells the API the geo ids to filter the date. |
geo_trunc |
Tells the API how to group data at geolocalization level when the geo_agg is informed. Accepted values: 'country', 'electric_system', 'autonomous_community', 'province', 'electric_subsystem', 'town' and 'drainage_basin'. |
A data.frame with value ( €/MWh), datetime, datetime_utc, tz_time, geo_id and geo_name.
e <- esios_pvpc()
e <- esios_pvpc()
Find which indicators are available.
esios_search_indicators( text = NULL, taxonomy_terms = NULL, taxonomy_ids = NULL )
esios_search_indicators( text = NULL, taxonomy_terms = NULL, taxonomy_ids = NULL )
text |
Text to search indicators |
taxonomy_terms |
Terms of indicators |
taxonomy_ids |
Ids of the indicators |
A data.frame with four columns: name, description, short_name and id.
ei <- esios_search_indicators() mercados <- esios_search_indicators(text = "Mercados y precios")
ei <- esios_search_indicators() mercados <- esios_search_indicators(text = "Mercados y precios")
Get all the CCAA available
get_ree_ccaa()
get_ree_ccaa()
A vector with the regions
get_ree_ccaa()
get_ree_ccaa()
To get a token you need to ask for it.
get_token(token = NULL)
get_token(token = NULL)
token |
The character string as a token |
Invisible the token
token <- get_token("aahdahgagdadfsafd")
token <- get_token("aahdahgagdadfsafd")
Retrieve data from Red Electrica Española.
ree_call( category, widget, start_date = end_date - 1, end_date = Sys.Date(), time_trunc = NULL, geo_trunc = NULL, region = "peninsular", lang = "es", parse = TRUE, ... )
ree_call( category, widget, start_date = end_date - 1, end_date = Sys.Date(), time_trunc = NULL, geo_trunc = NULL, region = "peninsular", lang = "es", parse = TRUE, ... )
category |
Type of data, one of c("balance", "demanda", "generacion", "intercambios", "transporte"). |
widget |
Defines what to retrieve. |
start_date |
Date |
end_date |
Date |
time_trunc |
One of |
geo_trunc |
Only accepts "electric_system". |
region |
One of |
lang |
Language: either "es" or "en". |
parse |
Decide if the function should try to parse the result or not (By default TRUE). |
... |
Other arguments passed to |
A data.frame by default or a list if parse = FALSE
.
rc <- ree_call(start_date = as.Date("2018-01-01"), end_date = "2018-12-31T23:59", time_trunc = "month", region = "peninsular", lang = "en", category = "demanda", widget = "ire-general") # rc2 <- ree_call(category = "balance", widget = "balance-electrico", # start_date = "2022-12-31T23:59", # region = "peninsular", lang = "en", time_trunc = "day") # rc3 <- ree_call(lang = "es", # category = "generacion", # widget = "estructura-generacion", # start_date = "2014-01-01T00:00", # end_date = "2018-12-31T23:59", # time_trunc = "year", # geo_trunc = "electric_system", # region = "Castilla la Mancha")
rc <- ree_call(start_date = as.Date("2018-01-01"), end_date = "2018-12-31T23:59", time_trunc = "month", region = "peninsular", lang = "en", category = "demanda", widget = "ire-general") # rc2 <- ree_call(category = "balance", widget = "balance-electrico", # start_date = "2022-12-31T23:59", # region = "peninsular", lang = "en", time_trunc = "day") # rc3 <- ree_call(lang = "es", # category = "generacion", # widget = "estructura-generacion", # start_date = "2014-01-01T00:00", # end_date = "2018-12-31T23:59", # time_trunc = "year", # geo_trunc = "electric_system", # region = "Castilla la Mancha")