Learn R Programming

timeSeries (version 280.75)

durations: Durations from a Time Series

Description

Compute durations from an object of class 'timeSeries'.

Usage

durations(x, trim = FALSE, units = c("secs", "mins", "hours"))   
durationSeries(...)

Arguments

trim
a logical value. By default TRUE, the first missing observation in the return series will be removed.
units
[durationSeries] - a character value or vector which allows to set the units in which the durations are measured. By default durations are measured in seconds.
x
an object of class timeSeries.
...
arguments to be passed.

Value

  • returns an object of class timeSeries.

Examples

Run this code
## data -  
   # Microsoft Data:
   setRmetricsOptions(myFinCenter = "GMT")
   MSFT = as.timeSeries(data(msft.dat))[1:20, "Open"]
   head(MSFT)

## durations -  
   # Durations in hours: Continuous Returns:
   durations(MSFT, units = "hours")

Run the code above in your browser using DataLab