- # Remove NAs. + filter TODO: merge with previous step: only one pass required...
- nas_indices = seq_len(ncol(series_matrix))[ sapply( 1:ncol(series_matrix),
- function(index) ( !filter(index) || any(is.na(series_matrix[,index])) ) ) ]
- series_matrix = series_matrix[,-nas_indices]
+ # TODO: merge with previous step: only one pass should be required
+ no_NAs_indices = sapply( 1:ncol(series_matrix), function(i) all(!is.na(series_matrix[,i])) )
+ series_matrix = series_matrix[,no_NAs_indices]