TSA (version 1.3)

zlag: Compute the lag of a vector.

Description

Computes the lag of a vector, with missing elements replaced by NA

Usage

zlag(x, d= 1)

Arguments

x

vector

d

compute the lag d of x

Value

A vector whose k-th element equals x[k-d] with x[t]=NA for t<=0

Examples

Run this code
# NOT RUN {
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
x=1:5
zlag(x,2)
# }

Run the code above in your browser using DataLab