Promediar del primero hasta el tercero, luego del segundo hasta el cuarto

I think you are describing a rolling average, here you can find some examples

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

2 Likes