rotate {container}R Documentation

Rotate Elements

Description

Rotate all elements n steps to the right. If n is negative, rotate to the left.

Usage

rotate(x, n = 1L)

ref_rotate(x, n = 1L)

## S3 method for class 'Deque'
rotate(x, n = 1L)

## S3 method for class 'Deque'
ref_rotate(x, n = 1L)

Arguments

x

any R object.

n

integer number of steps to rotate

Details

While rotate uses copy semantics, ref_rotate works by reference, that is, rotates in place on the original object.

Value

For Deque returns the rotated Deque() object.

Examples

d = deque(1, 2, 3, 4)
rotate(d)
rotate(d, n = 2)

[Package container version 1.0.4 Index]