Learn R Programming

mets (version 1.3.2)

dlag: Lag operator

Description

Lag operator

Usage

dlag(data, x, k = 1, combine = TRUE, simplify = TRUE, names, ...)

Arguments

data

data.frame or vector

x

optional column names or formula

k

lag (vector of integers)

combine

combine results with original data.frame

simplify

Return vector if possible

names

optional new column names

...

additional arguments to lower level functions

Examples

Run this code
d <- data.frame(y=1:10,x=c(10:1))
dlag(d,k=1:2)
dlag(d,~x,k=0:1)
dlag(d$x,k=1)
dlag(d$x,k=-1:2, names=letters[1:4])

Run the code above in your browser using DataLab