#
# Shift 1:10 one place to the right
#
shift.sequence(1:10,1, dir="right")
# [1] 10 1 2 3 4 5 6 7 8 9
#
# Shift 1:10 twos place to the right
#
shift.sequence(1:10,2, dir="right")
# [1] 9 10 1 2 3 4 5 6 7 8
#
# Shift 1:10 one place to the left
#
shift.sequence(1:10,1, dir="left")
# [1] 2 3 4 5 6 7 8 9 10 1
Run the code above in your browser using DataLab