a = [ \"a\", \"b\", \"c\", \"d\" ] a.rotate #=> [\"b\", \"c\", \"d\", \"a\"]
#rotate is a method of Array in R
#rotate
Array
You can achieve the same with a.push(a.shift). It basically removes the first element (shift) and appends it to the end (push).
a.push(a.shift)