Create a timeSeries Object


Creates an object of class timeSeries.


timeSeries(data, positions., units., from = timeCalendar(d = 1,
    m = 1, y = 1960), by = "days", k.by = 1, align.by = FALSE,
    week.align = NULL)


data (ANY) the variable data. Can be any data object for which is.rectangular is TRUE, such as a data.frame, matrix, or atomic vector.
positions. (positions) the x values for the variables. Must be of type positionsCalendar. If not given, then the positions are computed using the timeSeq function with the from, by, k.by, align, and week.align arguments.
units. (character) the units for the data.
from the starting value of the sequence. A timeDate object (or number or character string representing one).
by the spacing between successive values in the sequence. 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:

  • "milliseconds"
  • "seconds"
  • "minutes"
  • "hours"
  • "days"
  • "weekdays"
  • "bizdays"
  • "weeks"
  • "months"
  • "quarters"
  • "years"
giving the time units of intervals between values in the sequence.
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 only on the first of January, March, and so on. 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").)
  • If align.by is FALSE, the sequence is adjusted so that all its elements fall on the given weekday.
  • If align.by is TRUE, the sequence is adjusted to start at midnight.
In either case, the extend argument is used to specify which direction to adjust the day. This argument is ignored if by is not a character string, or if it is not "weeks".
See Also
timeSeries class, timeSequence.
timeSeries( pos=timeCalendar( d=1:10 ), data = 1:10)
timeSeries(data=data.frame(x=1:10, y=11:20), from="7/4/2000", by="bizdays")
Package splusTimeSeries version 6.0.0-68
Package Index