shift: shift a vector by 'shift_by' unit

Description Usage Arguments Author(s) Examples

View source: R/shift.r

Description

Repeat a vector by row

Usage

1
shift(x, shift_by)

Arguments

x

a vector

shift_by

number of shift

Author(s)

TszKin Julian Chan [email protected]

Examples

1
2
3
4
5
d<-data.frame(x=1:15)
#generate lead variable
d$df_lead2<-shift(d$x,2)
#generate lag variable
d$df_lag2<-shift(d$x,-2)

Jmisc documentation built on May 30, 2017, 6:21 a.m.

Related to shift in Jmisc...