I have the following data.frame:
New_Sign_ups Spend 2021-05 2021-06 2021-07 MRR_sum time
100 100 0 10 100 110 1.5
50 200 10 10 40 60 1.8
First, I need to do a row-wise cumulative sum for columns 3 ~ 5:
New_Sign_ups Spend 2021-05 2021-06 2021-07 MRR_sum time
100 100 0 10 110 110 1.5
50 200 10 20 60 60 1.8
Then I need to divide the cumulative sum by the Spend value of that row:
New_Sign_ups Spend 2021-05 2021-06 2021-07 MRR_sum time
100 100 0 0.1 1.1 110 1.5
50 200 0.05 0.1 0.3 60 1.8
How can I do this?