A vector of cumulative sums,
resetting whenever x is FALSE.
The return type is double if y is double; otherwise an integer vector. Integer
overflow wraps around, rather than being promoted to double type, as this
function is intended for 'shortish' runs of cumulative sums.
If length(x) == 0, y is returned (i.e. integer(0) or double(0).
Arguments
x
A logical vector indicating when the sum should continue.
Missing values in x is an error.
y
Optional: a numeric vector the same length as x to cumulatively sum.