glag: Generalized Lag Function

Description Usage Arguments Examples

Description

Compute a lagged version of a series or matrix, shifting the series by a given number. The shift number can be either positive or negative. Appropriate number of NA's are added either at the begging or end of the returned series so that it is the same length as the original series.

Usage

1
glag(x, k)

Arguments

x

An array.

k

A shift number. Can be potitive or negative integer.

Examples

1
2
3
4
x <- 1:10
glag(x, 3)
glag(MonthName(x), -3)
glag(matrix(1:24,nrow=6, ncol=4), 2)

einaooka/tea.utilities documentation built on May 16, 2019, 1:25 a.m.