powered by
Lag operator
dlag(data, x, k = 1, combine = TRUE, simplify = TRUE, names, ...)
data.frame or vector
optional column names or formula
lag (vector of integers)
combine results with original data.frame
Return vector if possible
optional new column names
additional arguments to lower level functions
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