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
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.1-7
Package Index