zlag: Compute the lag of a vector.

Description Usage Arguments Value Author(s) Examples

View source: R/zlag.R

Description

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

Usage

1
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

Author(s)

Kung-Sik Chan

Examples

1
2
3
4
5
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
x=1:5
zlag(x,2)

Example output

Loading required package: leaps
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-17. For overview type 'help("mgcv-package")'.
Loading required package: tseries

Attaching package: 'TSA'

The following objects are masked from 'package:stats':

    acf, arima

The following object is masked from 'package:utils':

    tar

[1] NA NA  1  2  3

TSA documentation built on July 2, 2018, 1:04 a.m.