Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

timeDate-Sequence

Regularly spaced 'timeDate' objects


Description

Create a regularly spaced object of class timeDate.

Usage

timeSequence(from, to = Sys.timeDate(), by, length.out = NULL,
            format = NULL, zone = "", FinCenter = "")

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

Arguments

from, to

starting date, required, and end date, optional. If supplied, to must be after (later than) from.

by
  • 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, or followed by "s".

  • character string "quarter" that is equivalent to "3 months".

  • A number, taken to be in seconds.

  • A object of class 'difftime'

length.out

length.out integer, optional. Desired length of the sequence, if specified "to" will be ignored.

along.with

Take the length from the length of this argument.

format

the format specification of the input character vector.

zone

the time zone or financial center where the data were recorded.

FinCenter

a character with the the location of the financial center named as "continent/city".

...

arguments passed to other methods.

Value

an object of class "timeDate".

Note

timeSequence() is a wrapper for the "timeDate" method of seq(), and that has been closely modeled after base R's POSIXt method, seq.POSIXt.

Examples

## timeSequence -

## autodetection of format :
(t1 <- timeSequence(from = "2004-03-12", to = "2004-04-11"))

stopifnot( ## different formats even:
  identical(t1, timeSequence(from = "2004-03-12", to = "11-Apr-2004")),
  identical(t1, ## explicit format and FinCenter :
      timeSequence(from = "2004-03-12", to = "2004-04-11",
                   format = "%Y-%m-%d", FinCenter = "GMT")))

## observe "switch to summer time":
timeSequence(from = "2004-03-12", to = "2004-04-11",
             FinCenter = "Europe/Zurich")

timeDate

Rmetrics - Chronological and Calendar Objects

v3043.102
GPL (>= 2)
Authors
Diethelm Wuertz [aut], Tobias Setz [cre], Yohan Chalabi [ctb], Martin Maechler [ctb], Joe W. Byers [ctb]
Initial release
2018-02-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.