This function calculates the cumulative sum over the (column) duration for one or more columns, by some other columns.
cumsum_duration(table, sumcols, bycols)
A data.table
with column duration
and other
columns matching the other arguments to the function.
A character vector of the columns to calculate the cumulative sum for.
A character vector of the columns to calculate the cumulative
sum by (i.e. as the argument by
to a data.table
).
A data.table
with the cumulative sums over duration.