new_period()
is a constructor for <grates_period>
objects aimed at
developers.
Usage
new_period(x = integer(), n = 1L, offset = 0L)
is_period(xx)
Arguments
- x
[integer]
Vector representing the number of periods since the Unix Epoch (1970-01-01) and a specified offset.
double
vectors will be converted viaas.integer(floor(x))
.- n
[integer]
Number of days that are being grouped by.
- offset
[integer]
Value you wish to start counting groups from relative to the Unix Epoch.
- xx
R object.
Details
grates_period
objects are stored as the integer number, starting at 0L, of
periods since the Unix Epoch (1970-01-01) and a specified offset. Here
periods are taken to mean groupings of n
consecutive days.
For storage and calculation purposes, offset
is scaled relative to n
.
I.e. offset <- offset %% n
and values of x
stored relative to this scaled
offset.