\HeaderA{lag}{Lag a Time Series}{lag}
\methaliasA{lag.default}{lag}{lag.default}
\keyword{ts}{lag}
\begin{Description}\relax
Compute a lagged version of a time series, shifting the time base
back by a given number of observations.
\end{Description}
\begin{Usage}
\begin{verbatim}
lag(x, ...)

## Default S3 method:
lag(x, k = 1, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] A vector or matrix or univariate or multivariate time series
\item[\code{k}] The number of lags (in units of observations).
\item[\code{...}] further arguments to be passed to or from methods.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Vector or matrix arguments \code{x} are coerced to time series.

\code{lag} is a generic function; this page documents its default
method.
\end{Details}
\begin{Value}
A time series object.
\end{Value}
\begin{Note}\relax
Note the sign of \code{k}: a series lagged by a positive \code{k}
starts \emph{earlier}.
\end{Note}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{diff}{diff}}, \code{\LinkA{deltat}{deltat}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
lag(ldeaths, 12) # starts one year earlier
\end{ExampleCode}
\end{Examples}

