Specifically, I have a data look like this:
counter
1
2
3
1
1
2
3
4
5
6
and I am looking for a new_column that can get the max value rowwise until it hit 1, which reset the whole process.
counter | new_column
1 | 3
2 | 3
3 | 3
1 | 1
1 | 6
2 | 6
3 | 6
4 | 6
5 | 6
6 | 6
How to achieve that in R/dplyr?