new_period {grates}R Documentation

Minimal constructor for a period object

Description

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 via as.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.

Value

A ⁠<grates_period>⁠ object.

Examples

new_period(1:10)


[Package grates version 1.2.1 Index]