Strings and Dates
Dates
Adding Days
R Date values support calendar arithmetic. Adding a number to a Date moves by that many days.
Program
Play the script to compute a due date and format it for display.
dates.R
start <- as.Date("2026-05-01")
due <- start + 14
label <- format(due, "%b %d")
cat(label, "\n", sep = "")
as.Date
`as.Date` converts date text to a Date value.
date arithmetic
`start + 14` advances the date by fourteen days.
format
`format` turns a Date into display text.