Lag: Create Lagged Variables

View source: R/tsModelSpec.R

LagR Documentation

Create Lagged Variables

Description

Create a matrix of lagged variables

Usage

Lag(v, k, group = NULL)

Arguments

v

a numeric vector

k

an integer vector giving lag numbers

group

a factor or a list of factors defining groups of observations

Examples

## Ten day "time series"
x <- rnorm(10)

## Lag 1 of `x'
Lag(x, 1)

## Lag 0, 1, and 2 of `x'
Lag(x, 0:2)


rdpeng/tsmodel documentation built on May 18, 2022, 5:52 a.m.