| cumsum_reset | R Documentation | 
Cumulative sum unless reset
cumsum_reset(x, y = as.integer(x))
| x | A logical vector indicating when the sum should continue.
Missing values in  | 
| y | Optional: a numeric vector the same length as  | 
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).
cumsum_reset(c(TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE))
cumsum_reset(c(TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE),
             c(1000, 1000, 10000,   10,   20,   33,     0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.