Generate consecutive daily dates from a single date or two range endpoints. Range endpoints are ordered, and requests outside the permitted range raise an error.
Usage
sequence_dates(date, min = "1950-01-01", max = Sys.Date(), hyphen = FALSE)Arguments
- date
character(1 or 2). A single date or two range endpoints in
"YYYY-MM-DD"format. Endpoints may be supplied in either order. Dates must be betweenminandmax, inclusive.- min
Date(1) or character(1). Inclusive lower bound for date validation. Character values use
"YYYY-MM-DD"format.- max
Date(1) or character(1). Inclusive upper bound for date validation. Character values use
"YYYY-MM-DD"format.- hyphen
logical(1). Include hyphens in the returned date strings. If
FALSE(the default), return"YYYYMMDD"; ifTRUE, return"YYYY-MM-DD".
Value
A character vector of daily dates in ascending order, including
both endpoints. A single input date returns one date string. The output
format is controlled by hyphen.
Details
Bounds are checked before generating the sequence. Any requested date outside the permitted range causes the entire request to raise an error; dates are not filtered or truncated. Remote file availability is not checked.