- private$.data[[length(private$.data)+1]] <- list(
- "time"=new_time, "centered_serie"=new_centered_serie, "level"=new_level,
- "exo"=new_exo, "exo_hat"=new_exo_hat)
+ if (!is.null(time) && !is.null(value) && !is.null(level_hat))
+ {
+ L = length(private$.tvp)
+ if (L == 0 || strftime( tail(private$.tvp[[L]]$time,1),
+ format="%H:%M:%S", tz="GMT" ) == "00:00:00")
+ {
+ # Append a new cell
+ private$.tvp[[L+1]] <- list("time"=time, "serie"=value, "level_hat"=level_hat)
+ }
+ else
+ {
+ # Complete current cell
+ private$.tvp[[L]]$time <- c(private$.tvp[[L]]$time, time)
+ private$.tvp[[L]]$serie <- c(private$.tvp[[L]]$serie, value)
+ private$.tvp[[L]]$level_hat <- c(private$.tvp[[L]]$levem_hat, level_hat)
+ }
+ }
+ if (strftime( tail(private$.tvp[[length(private$.tvp)]]$time,1),
+ format="%H:%M:%S", tz="GMT" ) == "00:00:00")
+ {
+ private$.level = c(private$.level,
+ mean(private$.tvp[[length(private$.tvp)]]$serie, na.rm=TRUE))
+ }
+ if (!is.null(exo))
+ private$.exo[[length(private$.exo)+1]] = exo
+ if (!is.null(exo_hat))
+ private$.exo_hat[[length(private$.exo_hat)+1]] = exo_hat