Skip to contents

Convert a set of timepoints to dates

Usage

time_to_date(
  timepoints,
  unit = attr(timepoints, "unit"),
  start_date = attr(timepoints, "start_date")
)

Arguments

timepoints

a set of numeric time points

unit

the period / unit of the time points, which will be extracted from timepoints if possible

start_date

the zero day of the time series, will be extracted from timepoints if possible

Value

a vector of dates

Examples

times = date_to_time(as.Date("2019-12-29")+0:100, "1 week")
dates = time_to_date(times)