The DT
must be a data.table
. If your data is a
data.frame
, you can convert it by reference using
data.table::setDT
.
The datetime
argument expects the name of a column in DT
which
is of type POSIXct
or the name of two columns in DT
which are
of type IDate
and ITime
.
threshold
must be provided in units of minutes, hours or days. The
character string should start with an integer followed by a unit, separated
by a space. It is interpreted in terms of 24 hours which poses the following
limitations:
minutes, hours and days cannot be fractional
minutes
must divide evenly into 60
minutes must not exceed 60
minutes,
hours which are nearer to the next day, are grouped as such
hours must
divide evenly into 24
multi-day blocks should divide into the range of
days, else the blocks may not be the same length
In addition, the threshold
is considered a fixed window throughout the
time series and the rows are grouped to the nearest interval.
If threshold
is NULL, rows are grouped using the datetime
column directly.