fix plots, fix F_Neighbors on series with NAs
[talweg.git] / pkg / R / F_Neighbors.R
index 238274b..202b7e2 100644 (file)
@@ -13,6 +13,10 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster",
                        # (re)initialize computed parameters
                        private$.params <- list("weights"=NA, "indices"=NA, "window"=NA)
 
+                       # Do not forecast on days with NAs (TODO: softer condition...)
+                       if (any(is.na(data$getCenteredSerie(today))))
+                               return (NA)
+
                        # Determine indices of no-NAs days followed by no-NAs tomorrows
                        fdays = getNoNA2(data, max(today-memory,1), today-1)