Calculating a moving averageAveraging a sequence in blocksFinding sequences of identical valuesFilling in NAs with last non-NA value