seq.Date
Sequences of Date-Times

### Description

Generate a vector of evenly spaced date-times.

### Usage

    ## S3 method for class 'Date':
    seq(from, to, by, length.out = NULL, along.with = NULL, ...)
    ## S3 method for class 'POSIXt':
    seq(from, to, by, length.out = NULL, along.with = NULL, ...)

### Arguments

from | a Date or POSIXt object representing the starting date. Required.
to | a Date or POSIXt object representing the ending date.
by | one of the following specifying the spacing between successive values in the sequence: an integer value, specifying the number of days for seq.Date and the number of seconds for seq.POSIXt. a character string, formed by an integer followed by a space and then a time unit. The time unit can be anything that partially matches "days", "weeks", "months", "quarters", or "years" for seq.Date and "secs", "mins", "hours", "days", "DSTdays", "weeks", "months", "quarters", or "years" for seq.POSIXt. Although "days" always means 86400 seconds, "DSTdays" can be greater than or less than 86400 seconds at the boundaries of daylight saving time. a difftime object.
length.out | an integer value specifying the length of the sequence. It is ignored if along.with is given. A non-integer input is rounded to integer by the ceiling function.
along.with | an object, if specified, whose length (instead of length.out) is used as the length of the sequence.
... | additional arguments.

Value
a Date or POSIXt object.
Differences between Spotfire Enterprise Runtime for R and Open-source R

- If from is the last day of the month and by is either "months" or "years", in Spotfire Enterprise Runtime for R the elements of the resulting sequence always adjust to the last day of month and no month is skipped or duplicated.

  Example R> seq(as.Date("2000-01-31"), by = "months", length = 12) [1] "2000-01-31" "2000-03-02" "2000-03-31" "2000-05-01" [5] "2000-05-31" "2000-07-01" "2000-07-31" "2000-08-31" [9] "2000-10-01" "2000-10-31" "2000-12-01" "2000-12-31"

  TERR> seq(as.Date("2000-01-31"), by = "months", length = 12) [1] "2000-01-31" "2000-02-29" "2000-03-31" "2000-04-30" [5] "2000-05-31" "2000-06-30" "2000-07-31" "2000-08-31" [9] "2000-09-30" "2000-10-31" "2000-11-30" "2000-12-31"

- Unlike open-source R, where exactly two of to, by, and length.out/along.with must be specified, in Spotfire Enterprise Runtime for R, if only length.out / along.with is specified, by = 1 is assumed.

See Also
seq, Date, POSIXt, cut.Date
Examples

    ## seq.Date
    d1 <- Sys.Date()
    d2 <- d1 + 100
    seq(d1, d2, by = 6)
    seq(d1, d2, by = "6 days")
    seq(d1, d2, by = .difftime(6, "days"))
    seq(d1, d2, by = "month")
    seq(d1, d2, by = "2 months")
    seq(d2, d1, by = "-1 month")
    seq(d1, d2, length.out = 4)
    seq(d1, d2, along.with = 1:4)
    seq(d1, by = 6, length.out = 4)
    ## seq.POSIXt
    ## The start date-time of DST in USA 2011 is: 2011-03-13 2:00AM
    from <- as.POSIXct("2011-03-12 20:23:14", tz = "US/Pacific")
    to <- as.POSIXct("2011-03-15 20:23:14", tz = "US/Pacific")
    seq(from, to, by = "days")
    seq(from, to, by = "DSTdays")
    from <- as.POSIXlt("2011-03-12 20:23:14", tz = "US/Pacific")
    to <- as.POSIXlt("2011-03-15 20:23:14", tz = "US/Pacific")
    seq(from, to, by = "days")
    seq(from, to, by = "DSTdays")

Package base version 6.1.5-18
Package Index