R: Generate Regular Sequences of Dates

seq.POSIXt {base} | R Documentation

## Generate Regular Sequences of Dates

### Description

The method for `seq` for data-time classes.

### Usage

    seq(from, to, by, length.out=NULL, along.with=NULL, ...)

### Arguments

`from` | starting date. Required
`to` | end date. Optional. If supplied must be after `from`.
`by` | increment of the sequence. Optional. See Details.
`length.out` | integer, optional. desired length of the sequence.
`along.with` | take the length from the length of this argument.
`...` | arguments passed to or from other methods.

### Details

`by` can be specified in several ways.

- A number, taken to be in seconds.
- A object of class `difftime`
- A character string, containing one of `"sec"`, `"min"`, `"hour"`, `"day"`, `"week"`, `"month"` or `"year"`. This can optionally be preceded by an integer and a space.

### Value

A vector of class `"POSIXct"`.

### See Also

`DateTimeClasses`

### Examples

    ## first days of years in the (commonly used) 20th century
    seq(ISOdate(1910,1,1), ISOdate(1999,1,1), "years")
    ## by month
    seq(ISOdate(2000,1,1), by="month", length=12)
    ## quarters
    seq(ISOdate(1990,1,1), ISOdate(2000,1,1), by="3 months")

[Package Contents]