X-Git-Url: https://git.auder.net/?p=talweg.git;a=blobdiff_plain;f=pkg%2FR%2FF_Neighbors.R;h=202b7e2472a4901f75f471391cf956b52d0294f0;hp=238274bd5f8b1202ab601c8ecea5aad83fc4b578;hb=a5a3a294279ad55df6241426be8bcf9546aa402b;hpb=98e958cab563866f8e00886b54336018a2e8bc97 diff --git a/pkg/R/F_Neighbors.R b/pkg/R/F_Neighbors.R index 238274b..202b7e2 100644 --- a/pkg/R/F_Neighbors.R +++ b/pkg/R/F_Neighbors.R @@ -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)