I need to calculate the following:
I have a data frame and I want to create one variable from another one in the following way. The new variable consists of adding all the values of variable 2 as long as they are greater than variable 1. I can not think of any way to do it.
Caso Var 1 Var2 Var a calcular 1 15 25 135 2 20 30 105 3 30 45 60 4 50 60 0