Learn R Programming

dateutils (version 0.1.5)

end_of_period: 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

Run this code
# NOT RUN {
end_of_period(as.Date("2019-09-15")) ## 2019-09-30
# }

Run the code above in your browser using DataLab