R/utils.R

Defines functions month_end quarter_end halfyear_end year_end

# Return end of annual date
year_end <- function(date) {
  as.Date(ISOdate(year(date),12,31))
}

# Return end of semiannual date
halfyear_end <- function(date) {
  lubridate::ceiling_date(date, "halfyear")-1
}

# Return end of quarter date
quarter_end <- function(date) {
  lubridate::ceiling_date(date, "quarter")-1
}

# Return end of month date
month_end <- function(date) {
  lubridate::ceiling_date(date, "month")-1
}

Try the pdfetch package in your browser

Any scripts or data that you put into this service are public.

pdfetch documentation built on Sept. 18, 2023, 9:08 a.m.