File: fin-durations.Rd

package info (click to toggle)
r-cran-timeseries 4041.111-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,704 kB
  • sloc: makefile: 14
file content (62 lines) | stat: -rw-r--r-- 1,356 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
\name{durations}
\alias{durations}

\alias{durationSeries} % removed


\title{Durations from a 'timeSeries'}

\description{
    
  Computes durations from an object of class \code{"timeSeries"}.  
       
}

\usage{  
durations(x, trim = FALSE, units = c("secs", "mins", "hours", "days"))   
}

\arguments{
  
  \item{x}{
    an object of class \code{"timeSeries"}.
  }
  \item{trim}{

    a logical value. By default \code{TRUE}, the first missing
    observation in the return series will be removed.

  }
  \item{units}{

    a character value or vector which allows to set the units in which
    the durations are measured. By default durations are measured in
    seconds.

  }
}

\details{

  Durations measure how long it takes until we get the next record in a
  \code{timesSeries} object. We return a time series in which for each
  time stamp we get the length of the period from when we got the last
  record. This period is measured in length specified by the argument
  \code{units}, for daily data use \code{units="days"}.
    
}

\value{
  an object of class \code{"timeSeries"}
}

\examples{
## Compute Durations in days for the MSFT Sereries - 
   head(durations(MSFT, units = "days"))
   head(durations(MSFT, trim = TRUE, units = "days"))

## The same in hours - 
   head(durations(MSFT, trim = TRUE, units = "hours"))
}

\keyword{chron}