From: Benjamin Auder Date: Tue, 11 Apr 2017 14:17:50 +0000 (+0200) Subject: 'update' X-Git-Url: https://git.auder.net/app_dev.php/DESCRIPTION?a=commitdiff_plain;h=41196789122f4b6bafeb7a306a3b4033637586f4;p=talweg.git 'update' --- 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)) ) + ) ] +}