R/dates.R

Defines functions advdate

Documented in advdate

#' Advance dates by week
#'
#' @description This function takes a start date, e.g. of a course,
#' and advances it by a number of weeks.
#' This function is used in the syllabus template.
#' @param startdate The first date in the series (e.g. first day of class).
#' @param week The number of weeks into the series.
#' Week 1 is the first date in the series.
#' @return A vector of dates in the format "dd mmm" in parentheses.
#' @examples
#' advdate("2021-06-23", 1:3)
#' @export
advdate <- function(startdate, week) {
  zadv <- as.Date(startdate) + 7 * (week - 1)
  tmp <- paste0("(", trimws(format(zadv, format = "%e %b")), ")")
  return(tmp)
}

Try the iheiddown package in your browser

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

iheiddown documentation built on Nov. 10, 2022, 5:52 p.m.