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 0000000..5986ced Binary files /dev/null and b/data/consumption.rda differ 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,