-1

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.

SolitonK
  • 103
  • 2

1 Answers1

0

Have you tried using the ifelse function? Something like this should work:

cumsum(ifelse(VarA == value, VarF, 0))
demongolem
  • 9,474
  • 36
  • 90
  • 105
F. Caru
  • 16