timeSeries-slotTime: Get and set time stamps of a 'timeSeries'

timeR Documentation

Get and set time stamps of a 'timeSeries'

Description

Functions and methods extracting and modifying positions of 'timeSeries' objects.

Usage

## S4 method for signature 'timeSeries'
time(x, ...)
## S3 replacement method for class 'timeSeries'
time(x) <- value

getTime(x)         
setTime(x) <- value

Arguments

value

a valid value for the time component of x.

x

an object of class timeSeries.

...

optional arguments passed to other methods.

Details

time and time<- are generic functions with methods for class "timeSeries". They get and set the time component of the object.

getTime and setTime are non-generic alternatives are non-generic wrappers of time and time<-, respectively.

There is another generic function time<- defined in package zoo. When that package is loaded its time<- gets the "timeSeries" method. Also, if "time<-" is called with an object from class other than "timeSeries", the call is dispatched to "zoo:time<-" to apply a suitable method.

Value

for time and getTime, a "timeDate" object,

for time<- and and setTime, the modified "timeSeries" object.

Examples

   
## Create Dummy 'timeSeries' -      
   X <- timeSeries(matrix(rnorm(24), 12), timeCalendar())
   
## Return Series Positions -
   getTime(X)
   time(X)  
  
## Add / Subtract one Day from X
   setTime(X) <- time(X) - 24*3600 # sec
   X
   time(X) <- time(X) + 24*3600 # sec
   X

timeSeries documentation built on Sept. 30, 2024, 9:15 a.m.