7 #' \item time: vector of times
8 #' \item serie: centered series
9 #' \item level: corresponding levels
10 #' \item exo: exogenous variables
11 #' \item exo_hat: predicted exogenous variables
15 #' @importFrom R6 R6Class
18 Data = R6::R6Class("Data",
26 getStdHorizon = function()
27 getStdHorizonData(private)
29 append = function(new_time, new_centered_serie, new_level, new_exo, new_exo_hat)
30 appendData(private, new_time, new_centered_serie, new_level, new_exo, new_exo_hat)
32 getTime = function(index)
33 getTimeData(self, private, index)
35 getCenteredSerie = function(index)
36 getCenteredSerieData(self, private, index)
38 getLevel = function(index)
39 getLevelData(self, private, index)
41 getSerie = function(index)
42 getSerieData(self, private, index)
44 getExo = function(index)
45 getExoData(self, private, index)
47 getExoHat = function(index)
48 getExoHatData(self, private, index)
52 #' Number of series in the dataset
54 #' @param private List of private members in current object
55 getSizeData = function(private)
58 #' 'Standard' horizon, from t+1 to midnight
60 #' @inheritParams getSizeData
61 getStdHorizonData = function(private)
62 24 - as.POSIXlt( private$.data[[1]]$time[1] )$hour + 1
64 #' Acquire a new vector of lists (time, centered_serie, level, exo, exo_hat)
66 #' @inheritParams getSizeData
67 #' @param new_time Time
68 #' @param new_centered_serie Centered serie
69 #' @param new_level Level
70 #' @param new_exo Exogneous variables
71 #' @param new_exo_hat Predicted exogenous variables
72 appendData = function(private, new_time, new_centered_serie, new_level, new_exo, new_exo_hat)
74 private$.data[[length(private$.data)+1]] <- list("time"=new_time,
75 "centered_serie"=new_centered_serie,"level"=new_level,"exo"=new_exo,"exo_hat"=new_exo_hat)
78 #' Time values at specified index
80 #' @inheritParams getSizeData
81 #' @param index Return value at this index
82 getTimeData = function(o, private, index)
84 index = dateIndexToInteger(index, o)
85 private$.data[[index]]$time
88 #' Centered serie values at specified index
90 #' @inheritParams getTimeData
91 getCenteredSerieData = function(o, private, index)
93 index = dateIndexToInteger(index, o)
94 private$.data[[index]]$centered_serie
97 #' Level of the serie at specified index
99 #' @inheritParams getTimeData
100 getLevelData = function(o, private, index)
102 index = dateIndexToInteger(index, o)
103 private$.data[[index]]$level
106 #' Serie values (centered+level) at specified index
108 #' @inheritParams getTimeData
109 getSerieData = function(o, private, index)
111 index = dateIndexToInteger(index, o)
112 private$.data[[index]]$centered_serie + data[[index]]$level
115 #' Exogenous measures at specified index
117 #' @inheritParams getTimeData
118 getExoData = function(o, private, index)
120 index = dateIndexToInteger(index, o)
121 private$.data[[index]]$exo
124 #' Exogeous predictions at specified index
126 #' @inheritParams getTimeData
127 getExoHatData = function(o, private, index)
129 index = dateIndexToInteger(index, o)
130 private$.data[[index]]$exo_hat