From 5a793fe45cd707e65d7d3a9675ec6fc69bd76cc0 Mon Sep 17 00:00:00 2001 From: pvictor Date: Thu, 2 Apr 2020 17:43:24 +0200 Subject: [PATCH] added consumption dataset --- R/data.R | 21 ++++++++++++++-- data-raw/elec-data.R | 50 +++++++++++++++++++++++++++++++++++++ data/consumption.rda | Bin 0 -> 713 bytes man/consumption.Rd | 24 ++++++++++++++++++ man/unhcr_popstats_2017.Rd | 2 +- man/unhcr_ts.Rd | 2 +- 6 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 data-raw/elec-data.R create mode 100644 data/consumption.rda create mode 100644 man/consumption.Rd diff --git a/R/data.R b/R/data.R index c016966..02dceec 100644 --- a/R/data.R +++ b/R/data.R @@ -2,7 +2,7 @@ #' #' The dataset contains data about UNHCR's populations of concern for the year 2017. #' -#' @format A data frame with 11237 observations on the following 6 variables. +#' @format A data frame with 11237 observations and the following 6 variables: #' \describe{ #' \item{\code{country_origin}}{Country of origin of population} #' \item{\code{country_residence}}{Country / territory of asylum/residence of population} @@ -20,7 +20,7 @@ #' #' The dataset contains data about UNHCR's populations of concern summarised by continent of origin. #' -#' @format A data frame with 913 observations on the following 4 variables. +#' @format A data frame with 913 observations and the following 4 variables: #' \describe{ #' \item{\code{year}}{Year concerned.} #' \item{\code{population_type}}{Populations of concern : Refugees, Asylum-seekers, Internally displaced persons (IDPs), Returned refugees, @@ -31,3 +31,20 @@ #' @source UNHCR (The UN Refugee Agency) (\url{https://www.unhcr.org/}) "unhcr_ts" + + +#' Electricity consumption and forecasting +#' +#' Electricity consumption per day in France for january and february of year 2020. +#' +#' @format A data frame with 120 observations and the following 3 variables: +#' \describe{ +#' \item{\code{date}}{date.} +#' \item{\code{type}}{Type of data : realised or forecast.} +#' \item{\code{value}}{Value in giga-watt per hour.} +#' } +#' @source Rte (Electricity Transmission Network in France) (\url{https://data.rte-france.com/}) +"consumption" + + + diff --git a/data-raw/elec-data.R b/data-raw/elec-data.R new file mode 100644 index 0000000..f858709 --- /dev/null +++ b/data-raw/elec-data.R @@ -0,0 +1,50 @@ +## code to prepare `elec-data` dataset goes here + + + +# Packages ---------------------------------------------------------------- + +library(data.table) +library(lubridate) +library(rte.data) +library(apexcharter) + + + + +# Consumption & forecast -------------------------------------------------- + +consumption <- get_consumption( + resource = "short_term", + type = c("REALISED", "D-1"), + start_date = "2020-01-01", + end_date = "2020-03-01" +) + +apex(consumption, aes(start_date, value, group = type), "line") + + +consumption <- consumption[, list(value = round(sum(value) / 4000)), by = list(date = as_date(start_date), type)] +consumption[type == "REALISED", type := "Realised"] +consumption[type == "D-1", type := "Forecast D-1"] + +apex(consumption, aes(date, value, group = type), "line") + +consumption <- as.data.frame(consumption) +usethis::use_data(consumption, overwrite = TRUE) + + + + + +# Actual generation ------------------------------------------------------- + +actual_generation <- get_actual_generation( + resource = "actual_generations_per_production_type", + start_date = "2017-06-12", + end_date = "2017-06-13" +) + + + + diff --git a/data/consumption.rda b/data/consumption.rda new file mode 100644 index 0000000000000000000000000000000000000000..5986ced13e896bfac8305bd26cb8db08c83d0dc8 GIT binary patch literal 713 zcmZ>Y%CIzaj8qGbwCj2j#=v^*|NsB>J}xfqB`&Tm0uK7=_n)}9`2TSMgY^GEhU)>Q zIo-Y5?QByeojDi#2b(f(H8iPopK?V0)x=julFSYnMkW`RFEKJX9~>YQ>JDxWJ^UmrdaWTTic%30vc0QwgDES520$ zU|hJs1gMy876ZeDiwhVSn7u7k4stjNv?yXF_HDheW4dAKu>+4+dfuLuwXjMc^Wv&Q z>d`JCpC=l=+MMK6Gi~+Bn_EAWc}4^+*yO(D?c8HAow2J3>`}xC)|4D!_cuoIVEftYt=W^g7B}u--K}8ONjkY zf9>VF$4%QDV;+QU)PA<@-ZWnal~s#QGH`irO7ZP^@xNix^kjFdX{8J*TURTU3aBhy zs2VOh)kSCtlb2Q2sTE06?cK{}-4gy$@$vETemNU3rM-5UW5e5OBaUqsr8tC~wiJ2z z70GfhoGH1W&F1rhi5!P{3}DD@MS93GpT$=jo?9+wZr{Lg;UELU;(ZK^Z+OBF{8*h> YDU>PItK_i%=$(mvA}aigc8WFt0GP-#lK=n! literal 0 HcmV?d00001 diff --git a/man/consumption.Rd b/man/consumption.Rd new file mode 100644 index 0000000..be28411 --- /dev/null +++ b/man/consumption.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{consumption} +\alias{consumption} +\title{Electricity consumption and forecasting} +\format{ +A data frame with 120 observations and the following 3 variables: +\describe{ +\item{\code{date}}{date.} +\item{\code{type}}{Type of data : realised or forecast.} +\item{\code{value}}{Value in giga-watt per hour.} +} +} +\source{ +Rte (Electricity Transmission Network in France) (\url{https://data.rte-france.com/}) +} +\usage{ +consumption +} +\description{ +Electricity consumption per day in France for january and february of year 2020. +} +\keyword{datasets} diff --git a/man/unhcr_popstats_2017.Rd b/man/unhcr_popstats_2017.Rd index f69b64f..b953aba 100644 --- a/man/unhcr_popstats_2017.Rd +++ b/man/unhcr_popstats_2017.Rd @@ -5,7 +5,7 @@ \alias{unhcr_popstats_2017} \title{UNHCR data for 2017} \format{ -A data frame with 11237 observations on the following 6 variables. +A data frame with 11237 observations and the following 6 variables: \describe{ \item{\code{country_origin}}{Country of origin of population} \item{\code{country_residence}}{Country / territory of asylum/residence of population} diff --git a/man/unhcr_ts.Rd b/man/unhcr_ts.Rd index 636b3ce..90527dc 100644 --- a/man/unhcr_ts.Rd +++ b/man/unhcr_ts.Rd @@ -5,7 +5,7 @@ \alias{unhcr_ts} \title{UNHCR data by continent of origin} \format{ -A data frame with 913 observations on the following 4 variables. +A data frame with 913 observations and the following 4 variables: \describe{ \item{\code{year}}{Year concerned.} \item{\code{population_type}}{Populations of concern : Refugees, Asylum-seekers, Internally displaced persons (IDPs), Returned refugees,