added ignoreNA (private function to handle and ignore NAs for sliding