round_dates: Round dates within the month

round_datesR Documentation

Round dates within the month

Description

Given a vector of date(s), return the first or last day of the month in which the date occurs

Usage

date_floor(dates)

date_ceiling(dates)

Arguments

dates

A vector of date(s)

Details

For each element in dates, date_floor() returns a date corresponding to the first day of the month in which the dates element falls. date_ceiling() returns the final day of the month.

Value

A vector of date(s) the same length as the input dates.

Examples

date_floor(Sys.Date())
date_floor(c(Sys.Date(), as.Date("2017-10-18")))
date_ceiling(c(Sys.Date(), as.Date("2017-10-18")))

djpr-data/djprshiny documentation built on May 14, 2023, 1:15 p.m.