added consumption dataset

This commit is contained in:
pvictor 2020-04-02 17:43:24 +02:00
parent 528489fc15
commit 5a793fe45c
6 changed files with 95 additions and 4 deletions

View File

@ -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"

50
data-raw/elec-data.R Normal file
View File

@ -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"
)

BIN
data/consumption.rda Normal file

Binary file not shown.

24
man/consumption.Rd Normal file
View File

@ -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}

View File

@ -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}

View File

@ -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,