end_of_period {dateutils}R Documentation

End of period date

Description

Return the date of the last day of the period (week, month, quarter, year). Weekly dates are indexed to Friday.

Usage

end_of_period(dates, period = c("month", "week", "quarter", "year"), shift = 0)

Arguments

dates

Date values formatted as.Date()

period

One of ''month'‘, '’week'‘, '’quarter'‘, '’year''.

shift

Integer, shift date forward (positive values) or backwards (negative values) by the number of periods.

Value

Last day of period in as.Date() format

Examples

end_of_period(as.Date("2019-09-15")) ## 2019-09-30

[Package dateutils version 0.1.5 Index]