new_month: Minimal Constructor for a month object

View source: R/month.R

new_monthR Documentation

Minimal Constructor for a month object

Description

new_month() is a constructor for ⁠<grates_month>⁠ objects aimed at developers.

Usage

new_month(x = integer(), n)

is_month(xx)

Arguments

x

⁠[integer]⁠

Vector representing the number of n-months since the Unix Epoch (1970-01-01).

double vectors will be converted via as.integer(floor(x)).

n

⁠[integer]⁠

Number of months that are being grouped. Must be greater than 1 (use yearmonth() for this case).

xx

R object.

Details

grates_month objects are stored as the integer number (starting at 0), of n-month groups since the Unix Epoch (1970-01-01). Here n-months is taken to mean a 'grouping of n consecutive months'.

Value

A ⁠<grates_month>⁠ object.

References

The algorithm to convert between dates and months relative to the UNIX Epoch comes from the work of Davis Vaughan in the unreleased datea package.

Examples

new_month(1:10, 2L)


grates documentation built on July 9, 2023, 7:09 p.m.