I have a 306x19 data-set and I would like to use the Cumsum function on say, VarF only when VarA takes a certain value.
On a high-level description, the idea is to filter on VarA and apply a cumsum on the remaining of the dataset (VarF).
I would appreciate any pointers here guy on how to solve this.
Have you tried using the ifelse function? Something like this should work:
cumsum(ifelse(VarA == value, VarF, 0))