Learn R Programming

timeSeries (version 4021.104)

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

# S4 method for timeSeries time(x, ...) # S3 method for timeSeries time(x) <- value

Value

Returns a 'timeDate' object.

Arguments

value

a valid value for the component of time(x).

x

an object of class timeSeries.

...

optional arguments passed to other methods.

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