Skip to contents

Compute a vector giving the mid-points of a vector of temporal periods, defined by start dates and one of either a vector of end dates or a vector of period lengths in days (see num_days). You can either return a date, with mid_dates, or a date-time, with mid_times. In addition to the type of return value (date vs time), the former rounds down to the nearest date whereas the latter is accurate to the nearest hour and so can account for uneven

Usage

mid_dates(start_date, end_date, period_length)

mid_times(start_date, end_date, period_length)

Arguments

start_date

Vector of period starting dates

end_date

Vector of period ending dates. If missing then period_length is used to define the ends of the periods.

period_length

Vector of integers giving the period length in days. If missing then it is calculated using num_days.