File: stats-lag.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 (65 lines) | stat: -rw-r--r-- 1,330 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
63
64
65
\name{lag}
\alias{lag}

\alias{lag.timeSeries}


\title{Lag a 'timeSeries' object}

\description{
    
  Compute a lagged version of a \code{"timeSeries"} object.
   
}

\usage{
\method{lag}{timeSeries}(x, k = 1, trim = FALSE, units = NULL, \dots)
}

\arguments{
         
  \item{x}{
    an object of class \code{timeSeries}.
  } 
  \item{k}{
    
    an integer number, the number of lags (in units of observations).
    By default 1. Can also be a vector, in which case the result is a
    multivariate \code{"timeSeries"} in which column \code{i} contains
    the series lagged by \code{k[i]}, see the examples.

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

    an optional character string, which allows to overwrite the current
    column names of a \code{"timeSeries"} object. By default \code{NULL}
    which means that the column names are selected automatically.

  }
  \item{\dots}{
    arguments passed to other methods.
  }
}

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

\seealso{
  \code{\link[stats]{lag}} for \verb{stats::lag},
  \code{\link{diff}}
}

\examples{
## Load Micsrosoft Data Set
x <- MSFT[1:20, "Open"]
   
## Lag the 'timeSeries' Object
lag(x, k = -1:1)
}

\keyword{chron}