Calculate the mean of the first month of every year across the whole dataset before doing conditionally selecting and replacing data.