- # Determine indices of no-NAs days followed by no-NAs tomorrows
- fdays = getNoNA2(data, 1, dateIndexToInteger(index,data)-1)
- # Series + tomorrows in columns, ref_serie first
- centered_series = data$getCenteredSeries(fdays)
-
- # Obtain neighbors (closest for euclidian norm)
- L = length(ref_serie)
- distances = sqrt( colSums( (centered_series - ref_serie)^2 / L ) )
- sorted_distances = sort(distances, index.return=TRUE)
-