- lastSerie = c( data$getSerie(today-1), data$getSerie(today)[1:(predict_from-1)] )
- distances2 = sapply(fdays, function(i) {
- delta = lastSerie - c(data$getSerie(i),data$getSerie(i+1)[1:(predict_from-1)])
+ lastSerie = c( data$getSerie(today-1),
+ data$getSerie(today)[if (predict_from>=2) 1:(predict_from-1) else c()] )
+ distances2 = sapply(tdays, function(i) {
+ delta = lastSerie - c(data$getSerie(i-1),
+ data$getSerie(i)[if (predict_from>=2) 1:(predict_from-1) else c()])