shift: shift a vector by 'shift_by' unit

Description Usage Arguments Author(s) Examples

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)


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

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.