fix mistake in yersteday/today computations
[talweg.git] / pkg / R / utils.R
index 96ec601..a4efd61 100644 (file)
@@ -118,7 +118,7 @@ getSimilarDaysIndices = function(index, data, limit, same_season, days_in=NULL)
 
 # getNoNA2
 #
-# Get indices in data of no-NA series followed by no-NA, within [first,last] range.
+# Get indices in data of no-NA series preceded by no-NA, within [first,last] range.
 #
 # @inheritParams dateIndexToInteger
 # @param first First index (included)
@@ -127,6 +127,6 @@ getSimilarDaysIndices = function(index, data, limit, same_season, days_in=NULL)
 .getNoNA2 = function(data, first, last)
 {
        (first:last)[ sapply(first:last, function(i)
-               !any( is.na(data$getSerie(i)) | is.na(data$getSerie(i+1)) )
+               !any( is.na(data$getSerie(i-1)) | is.na(data$getSerie(i)) )
        ) ]
 }