Using a start_date and a unit specification
Usage
date_to_time(
dates,
unit = .day_interval(dates),
start_date = 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. If another
time_period
is given as the unit then the- start_date
the origin of the conversion. Defaults to the beginning of the COVID pandemic
Examples
times = date_to_time(as.Date("2019-12-29")+0:100, "1 week")
dates = time_to_date(times)