shift | R Documentation |
shift_by
unitRepeat a vector by row
shift(x, shift_by)
x |
a vector |
shift_by |
number of shift |
TszKin Julian Chan ctszkin@gmail.com
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.