timeSequence
Create a Time Sequence Object

Description

Constructs a timeSequence object.

Usage

timeSequence(from, to, by, length.out, k.by=1, align.by=FALSE,  
             extend=FALSE, week.align=NULL, holidays=timeDate(), exceptions, 
             additions, format, zone )

Arguments

If any arguments are supplied, exactly three of from, to, by, and length.out must be supplied.
from the starting value of the sequence: a timeDate object (or number or character string representing one).
to the ending value of the sequence: a timeDate object (or number or character string representing one).
by the spacing between successive values in the sequence. This can be a timeSpan, timeRelative, or numeric value, in which case k.by is ignored. Alternatively, it can be one of the following character strings giving the time units of intervals between values in the sequence: "milliseconds" "seconds" "minutes" "hours" "days" "weekdays" "bizdays" "weeks" "months" "quarters" "years"
length.out the length of the sequence before additions and exceptions.
k.by a non-zero integer giving the width of the interval between consecutive values in the sequence in terms of the units given in by. Ignored if by is not a character string.
align.by a logical value. If TRUE, adjusts the sequence so that each element is on a whole number of the by * k.by units. For example, if the units are 2 months, the sequence is on only the first of January, March, May, and so on. Ignored if by is not a character string.
extend a logical value. If TRUE and align.by is also TRUE, instead of making the entire sequence lie between from and to, make it extend just past from and to to the next aligned values. For example, if from is January 15th and the sequence is by 1 month units, and if extend is FALSE, the sequence starts on February 1st If extend is TRUE, the sequence starts on January 1st. Ignored if by is not a character string.
week.align if by is "weeks", you can supply a character string (or a number 0 to 6, with 0 being Sunday) to specify a weekday to use. The character string must be sufficient to make a unique case-insensitive match to the strings in timeDateOptions("time.day.name"). The sequence is adjusted so all its elements fall on the given weekday. If align.by is TRUE, then it is also adjusted to start at midnight.

In either case, the extend argument is used to decide which direction to adjust the day. This argument is ignored if by is not a character string, or if it is not "weeks".

holidays the holidays for business day sequences (ignored if by is not a character string).
exceptions an event object giving time periods when sequence should not have any values. These are applied after the sequence is created from from/to/by/length.out.
additions additional times/dates to put in the sequence.
format the time/date output format for printing.
zone the time zone for the sequence.
Value
returns a time sequence object as defined by the arguments. Note that the timeSeq function is similar, except that it returns a time/date vector. This function returns a compact time sequence object that retains information about the sequence.
See Also
timeSeq, timeSequence, holidays, timeEvent
Examples
timeSequence("1/1/1992", "12/1/1992", by = "months") 
timeSequence("1/3/1992", "12/5/1992", by = "months", align.by=TRUE) 
timeSequence("1/1/1992", "1/31/1992", by = "weeks", align.by=TRUE,  
             week.align="Mon")
timeSequence("1/1/1992", "12/31/1992", by="weekdays", exceptions=holidays(1992))
timeSequence("1/1/1992", "1/1/1995", by="months", exceptions=timeEvent("1/1/1993", "12/31/1993"))
Package splusTimeDate version 6.0.0-68
Package Index