powered by
Rotate all elements n steps to the right. If n is negative, rotate to the left.
n
rotate(x, n = 1L)ref_rotate(x, n = 1L)# S3 method for Deque rotate(x, n = 1L)# S3 method for Deque ref_rotate(x, n = 1L)
ref_rotate(x, n = 1L)
# S3 method for Deque rotate(x, n = 1L)
# S3 method for Deque ref_rotate(x, n = 1L)
For Deque returns the rotated Deque() object.
Deque
Deque()
any R object.
R
integer number of steps to rotate
integer
While rotate uses copy semantics, ref_rotate works by reference, that is, rotates in place on the original object.
rotate
ref_rotate
d = deque(1, 2, 3, 4) rotate(d) rotate(d, n = 2)
Run the code above in your browser using DataLab