LagVector: Lag a Vector

View source: R/LagVector.R

LagVectorR Documentation

Lag a Vector

Description

Compute a lagged version of a numeric vector, shifting the time base back or forward by a given number of observations.

Usage

LagVector(x, k)

Arguments

x

[1:n] vector

k

The number of lags (in units of observations): back shifting: positiv value, forward shifting: negative value

Details

for time series please use lag

Value

Shifted vector [1:n] with k NaN values at the beginning (k positive) or the end (k negative)

Author(s)

Michael Thrun

See Also

lag

Examples

LagVector(1:100,5)
LagVector(1:100,-5)

Mthrun/TSAT documentation built on Feb. 5, 2024, 11:15 p.m.