R/utils.R

Defines functions validate_seasons

validate_seasons <- function(seasons, start_year) {
  if (!is.numeric(seasons)) {
    stop("Expected a numeric vector of years")
  }
  current_year <- lubridate::year(Sys.Date())

  for (year in seasons) {
    if (!is.numeric(year) || length(year) != 1) {
        stop(sprintf("Expected an integer for year, got %s", typeof(year)))
    }
    if (year < start_year || year > current_year) {
      stop(sprintf("Year %d is out of range. Valid range is %d to %d",
                   year, start_year, current_year))
    }
  }
}

Try the rvolleydata package in your browser

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

rvolleydata documentation built on Nov. 5, 2025, 7:01 p.m.