Skip to contents

new_isoweek() is a constructor for <grates_isoweek> objects aimed at developers.

Usage

new_isoweek(x = integer())

is_isoweek(xx)

Arguments

x

[integer]

Vector representing the number of weeks.

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

xx

R object.

Value

A <grates_isoweek> object.

Details

isoweeks are defined to start on a Monday and <grates_isoweek> objects are stored as the number of weeks (starting at 0) from the first Monday prior to the Unix Epoch (1970-01-01). That is, the number of seven day periods from 1969-12-29.

Internally they have the same representation as a <grates_yearweek_monday> object so are akin to an alias but with a marginally more efficient implementation.

Examples

new_isoweek(1:10)
#> <grates_isoweek[10]>
#>  [1] "1970-W02" "1970-W03" "1970-W04" "1970-W05" "1970-W06" "1970-W07"
#>  [7] "1970-W08" "1970-W09" "1970-W10" "1970-W11"