data.table
with columns time
and duration
.Creates a data.table
with columns time
and duration
,
in which the column time
corresponds to the (unique) times in the
input table. In the output, the most recent time given a duration of 1, the
second most recent time given a duration of 2, and so on.
times_and_durations(d)
A data.table
containing at least a column time
, which
is sortable. For example, could be POSIXct dates.
A new data.table
, containing columns time
(key column)
and duration
.