eLag: Convert vector into a matrix of lag columns

Description Usage Arguments Value See Also Examples

View source: R/expandFunctions.R

Description

Convert vector into a matrix of lag columns

Usage

1
eLag(x, colParamVector, pad = NA)

Arguments

x

Data vector

colParamVector

Vector of lags for embedding

pad

Scalar for padding embedding

Value

A matrix whose columns are x lagged by the corresponding values in colParamVector.

See Also

embed and embedd, which are related functions.

Examples

1
2
eLag(1:6, 0:2)
eLag(1:6, 0:2, pad=0)

Example output

     [,1] [,2] [,3]
[1,]    1   NA   NA
[2,]    2    1   NA
[3,]    3    2    1
[4,]    4    3    2
[5,]    5    4    3
[6,]    6    5    4
[7,]   NA    6    5
[8,]   NA   NA    6
     [,1] [,2] [,3]
[1,]    1    0    0
[2,]    2    1    0
[3,]    3    2    1
[4,]    4    3    2
[5,]    5    4    3
[6,]    6    5    4
[7,]    0    6    5
[8,]    0    0    6

expandFunctions documentation built on May 2, 2019, 9:15 a.m.