# NOT RUN {
x <- 1:10
shift(x, 1) # shift positive (from beginning of vector) by 1
shift(x, -1) # shift negative (from end of vector) by 1
shift(x, 5, 0) # Shift by 5 and fill (pad) with 0
# }
Run the code above in your browser using DataLab