cstime
provides date time functions for public health purposes.
The core functionality is consistent time conversion between :
- Date.
- Isoyear, isoweek, isoyearweek.
- Season week.
It also provides functions to generate rolling dates for computing the weekly, bi-weekly, 4 week averages.
cstime
is part of the csverse package suite.
To convert a date to isoyear:
date_to_isoyear_c('2021-01-01')
#> [1] "2020"
To convert a isoyearweek string to isoyear/isoweek:
isoyearweek_to_isoyear_c("2021-02")
#> [1] "2021"
isoyearweek_to_isoweek_c("2021-02")
#> [1] "02"
To convert a season week to isoweek (and reverse):
seasonweek_to_isoweek_n(10)
#> [1] 39
isoweek_to_seasonweek_n(1)
#> [1] 24