Using a day_zero and a unit specification or a full sequence of dates (see 'full_seq_dates()')
![[Deprecated]](figures/lifecycle-deprecated.svg)
Usage
date_to_time(
dates,
unit = .day_interval(dates),
day_zero = getOption("day_zero", "2019-12-29")
)
Arguments
- dates
a vector of dates to convert
- unit
a specification of the unit of the resulting time series. Will be determined from periodicity of dates if not specified
- day_zero
the origin of the conversion. Defaults to the beginning of the COVID pandemic
Value
a sequence of numeric time points as the number of periods since day zero
Examples
# DEPRECATED
# times = date_to_time(as.Date("2019-12-29")+0:100, "1 week")
# dates = time_to_date(times)