I have a situation where I want the next row's value to be picked up for updating a column instead of the row in which the condition is met. So the conventional ifelse is not working for me.
For example, if the value of column C is greater than 80 then I want the value of column D to be updated with the value of column A, but in the next row. The dummy data set is
A B C D
10 11 12 0
1 13 14 0
3 4 85 0
78 56 56 0
70 80 16 0
60 67 86 0
50 65 77 0
The expected dataset is
A B C D
10 11 12 0
1 13 14 0
3 4 85 0
78 56 56 78
70 80 16 0
60 67 86 0
50 65 77 50