R/days_in_cyear.R

Defines functions days_in_cy

Documented in days_in_cy

#' Get the number of days in a calendar year
#'
#' Need to obtain the number of days in a year
#'
#' @param  x A calendar year in format yyyy
#' @return The number of days in the calendar year
#' @examples
#' days_in_cy(2012)
#' days_in_cy(2011)
#' @export

days_in_cy <- function(x){
  days_in_yr <- ifelse(lubridate::leap_year(as.numeric(x)), 366, 365)
  return(days_in_yr)
}
PublicHealthEngland/hcaidcs documentation built on Jan. 19, 2024, 8:38 a.m.