From: Benjamin Auder Date: Sat, 25 Feb 2017 13:40:25 +0000 (+0100) Subject: 'update' X-Git-Url: https://git.auder.net/js/css/%7B%7B%20path%28%27fos_user_security_login%27%29%20%7D%7D?a=commitdiff_plain;h=35eb1443d0ae161c730e371e08e576754ec0084d;p=talweg.git 'update' --- diff --git a/pkg/R/Data.R b/pkg/R/Data.R index 4e16805..18c67dd 100644 --- a/pkg/R/Data.R +++ b/pkg/R/Data.R @@ -16,29 +16,21 @@ #' #' @export Data = R6Class("Data", + private = list( + .data = "list" + ), public = list( - data = "list", initialize = function(...) - { - "Initialize empty Data object" -#TODO: continue from here - callSuper(...) - }, + initialize(self, private, ...) + , getSize = function() - { - "Number of series in the dataset" - - length(data) - }, + getSize() + , getStdHorizon = function() - { - "'Standard' horizon, from t+1 to midnight" - - 24 - as.POSIXlt( data[[1]]$time[1] )$hour + 1 - }, + getStdHorizon(self, private) + , append = function(new_time, new_serie, new_level, new_exo_hat, new_exo) - { - "Acquire a new vector of lists (time, serie, level, exo_hat, exo)" + append(self, private, data[[length(data)+1]] <<- list("time"=new_time,"serie"=new_serie,"level"=new_level, "exo_hat"=new_exo_hat,"exo"=new_exo) @@ -87,3 +79,19 @@ Data = R6Class("Data", } ) ) + +#' Initialize empty Data object +initialize = function(self, private, ...) +{ + invisible(self) +} + +#' Number of series in the dataset +getSize = function(self, private) + length(private$.data) + +#' 'Standard' horizon, from t+1 to midnight +getStdHorizon = function(self, private) + 24 - as.POSIXlt( private$.data[[1]]$time[1] )$hour + 1 + +#' Acquire a new vector of lists (time, centered_serie, level, exo, exo_hat)