6 #' @importFrom R6 R6Class
8 #' @field .data List of \itemize{
9 #' \item time: vector of times
10 #' \item serie: centered series
11 #' \item level: corresponding levels
12 #' \item exo: exogenous variables
13 #' \item exo_hat: predicted exogenous variables}
15 #' @section Methods: \describe{
16 #' \item{\code{getSize()}}
17 #' {Return number of series in dataset.}
18 #' \item{\code{getStdHorizon()}}
19 #' {Return number of time steps from serie[1] until midnight}
20 #' \item{\code{append(new_time, new_centered_serie, new_level, new_exo, new_exo_hat)}}
21 #' {Acquire a new vector of lists (time, centered_serie, level, exo, exo_hat).}
22 #' \item{\code{getTime(index)}}
23 #' {Get times at specified index.}
24 #' \item{\code{getCenteredSerie(index)}}
25 #' {Get centered serie at specified index.}
26 #' \item{\code{getLevel(index)}}
27 #' {Get level at specified index.}
28 #' \item{\code{getSerie(index)}}
29 #' {Get serie (centered+level) at specified index.}
30 #' \item{\code{getExo(index)}}
31 #' {Get exogenous variables at specified index.}
32 #' \item{\code{getExoHat(index)}}
33 #' {Get estimated exogenous variables at specified index.} }
34 Data = R6::R6Class("Data",
42 getStdHorizon = function()
43 24 - as.POSIXlt( private$.data[[1]]$time[1] )$hour + 1
47 private$.data[[length(private$.data)+1]] <- list(
48 "time"=new_time, "centered_serie"=new_centered_serie, "level"=new_level,
49 "exo"=new_exo, "exo_hat"=new_exo_hat)
51 getTime = function(index)
53 index = dateIndexToInteger(index, self)
54 private$.data[[index]]$time
56 getCenteredSerie = function(index)
58 index = dateIndexToInteger(index, self)
59 private$.data[[index]]$centered_serie
61 getLevel = function(index)
63 index = dateIndexToInteger(index, self)
64 private$.data[[index]]$level
66 getSerie = function(index)
68 index = dateIndexToInteger(index, self)
69 private$.data[[index]]$centered_serie + private$.data[[index]]$level
71 getExo = function(index)
73 index = dateIndexToInteger(index, self)
74 private$.data[[index]]$exo
76 getExoHat = function(index)
78 index = dateIndexToInteger(index, self)
79 private$.data[[index]]$exo_hat
81 removeFirst = function()
82 private$.data <- private$.data[2:length(private$.data)]
84 removeLast = function()
85 private$.data <- private$.data[1:(length(private$.data)-1)]