Learn R Programming

timeSeries (version 3011.98)

time: Get and Set Time stamps of a 'timeSeries'

Description

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

Usage

getTime(x)         
setTime(x) <- value

## S3 method for class 'timeSeries': time(x, \dots) ## S3 method for class 'timeSeries': time(x) <- value

Arguments

value
a valid value for the component of time(x).
x
an object of class timeSeries.
...
optional arguments passed to other methods.

Value

  • Returns a 'timeDate' object.

Examples

Run this code
## 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

Run the code above in your browser using DataLab