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 ctszkin@gmail.com

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 20, 2017, 4:02 a.m.

Search within the Jmisc package
Search all R packages, documentation and source code