new_yearmonth {grates}R Documentation

Minimal constructor for a yearmonth object

Description

new_yearmonth() is a constructor for ⁠<grates_yearmonth>⁠ objects aimed at developers.

Usage

new_yearmonth(x = integer())

is_yearmonth(xx)

Arguments

x

⁠[integer]⁠

Vector representing the number of months.

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

xx

R object

Details

⁠<grates_yearmonth>⁠ objects are stored as the number of months (starting at 0) since the Unix Epoch (1970-01-01). Precision is only to the month level (i.e. the day of the month is always dropped).

Value

A ⁠<grates_yearmonth>⁠ 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_yearmonth(1:10)


[Package grates version 1.2.0 Index]