From 41196789122f4b6bafeb7a306a3b4033637586f4 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Tue, 11 Apr 2017 16:17:50 +0200 Subject: [PATCH] 'update' --- pkg/R/F_Neighbors.R | 15 --------------- pkg/R/plot.R | 2 +- pkg/R/utils.R | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pkg/R/F_Neighbors.R b/pkg/R/F_Neighbors.R index 9af4725..32d5cff 100644 --- a/pkg/R/F_Neighbors.R +++ b/pkg/R/F_Neighbors.R @@ -216,21 +216,6 @@ NeighborsForecaster = R6::R6Class("NeighborsForecaster", ) ) -#' getNoNA2 -#' -#' Get indices in data of no-NA series followed by no-NA, within [first,last] range. -#' -#' @inheritParams dateIndexToInteger -#' @param first First index (included) -#' @param last Last index (included) -#' -.getNoNA2 = function(data, first, last) -{ - (first:last)[ sapply(first:last, function(i) - !any( is.na(data$getCenteredSerie(i)) | is.na(data$getCenteredSerie(i+1)) ) - ) ] -} - #' getConstrainedNeighbs #' #' Get indices of neighbors of similar pollution level (among same season + day type). diff --git a/pkg/R/plot.R b/pkg/R/plot.R index 48b456c..fe2fb4e 100644 --- a/pkg/R/plot.R +++ b/pkg/R/plot.R @@ -236,7 +236,7 @@ plotRelVar = function(data, fil) { ref_var = c( apply(data$getSeries(fil$neighb_indices),1,sd), apply(data$getSeries(fil$neighb_indices+1),1,sd) ) - fdays = getNoNA2(data, 1, fil$index-1) + fdays = .getNoNA2(data, 1, fil$index-1) global_var = c( apply(data$getSeries(fdays),1,sd), apply(data$getSeries(fdays+1),1,sd) ) diff --git a/pkg/R/utils.R b/pkg/R/utils.R index ddf0bb1..3f32868 100644 --- a/pkg/R/utils.R +++ b/pkg/R/utils.R @@ -115,3 +115,18 @@ getSimilarDaysIndices = function(index, data, limit, same_season, days_in=NULL) return (day %in% 1:4) return (day == day_ref) } + +#' getNoNA2 +#' +#' Get indices in data of no-NA series followed by no-NA, within [first,last] range. +#' +#' @inheritParams dateIndexToInteger +#' @param first First index (included) +#' @param last Last index (included) +#' +.getNoNA2 = function(data, first, last) +{ + (first:last)[ sapply(first:last, function(i) + !any( is.na(data$getCenteredSerie(i)) | is.na(data$getCenteredSerie(i+1)) ) + ) ] +} -- 2.44.0