Vectorisation of loop accessing preceding values on a row by row basis
I need to roll through a dataframe and update the estimate in column 2 based on the previous value in column 1 and column 2. I am looking for ideas on how to vectorise this approach/speed it up as it is currently quite costly in the loop format below. The first row is set to 0 as there is no preceding value.