chron (version 2.2-15)

seq.dates: Generate Chron or Dates Sequences

Description

Generate a regular sequence of dates.

Usage

seq.dates(from, to, by = "days", length.)

Arguments

from
starting date; it can be a chron or dates object, a character string, e.g., "05/23/91", or a Julian date.
to
ending date, like from.
by
either a numeric value or one of the valid strings "days", "weeks", "months", or "years".
length.
optional number of elements in the sequence.

Value

  • a sequence with values (form, from + by, from + 2*by, ...

code

to

See Also

chron, dates, cut.dates

Examples

Run this code
seq.dates("01/01/92", "12/31/92", by = "months")
# [1] 01/01/92 02/01/92 03/01/92 04/01/92 05/01/92 06/01/92
# [7] 07/01/92 08/01/92 09/01/92 10/01/92 11/01/92 12/01/92

end.of.the.month <- seq.dates("02/29/92", by = "month", length = 15)
end.of.the.month
#  [1] 02/29/92 03/31/92 04/30/92 05/31/92 06/30/92 07/31/92
#  [7] 08/31/92 09/30/92 10/31/92 11/30/92 12/31/92 01/31/93
# [13] 02/28/93 03/31/93 04/30/93

Run the code above in your browser using DataCamp Workspace