Intro to cstime

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

cstime provides date time functions for public health purposes.

The core functionality is consistent time conversion between :

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.

library(cstime)
library(magrittr)

To convert a date to isoyear:

date_to_isoyear_c('2021-01-01')

To convert a isoyearweek string to isoyear/isoweek:

isoyearweek_to_isoyear_c("2021-02")
isoyearweek_to_isoweek_c("2021-02")

To convert a season week to isoweek (and reverse):

seasonweek_to_isoweek_n(10)
isoweek_to_seasonweek_n(1)  


Try the cstime package in your browser

Any scripts or data that you put into this service are public.

cstime documentation built on May 31, 2023, 9:27 p.m.