Dynamically calculate rolling average conditional upon NA values I have data that looks something like this.