Learn R Programming

binaryLogic (version 0.3.9)

rotate: Rotate no carry ()

Description

A circular shift

Usage

rotate(x, n)

Arguments

x

The binary number to rotate. (binary or logical vector).

n

The number of bits to rotate.

Value

rotates the vector from left to right. The value from MSB is used to fill up the vector at LSB. Returns a binary/logical vector.

See Also

shiftLeft and shiftRight

Examples

Run this code
# NOT RUN {
x <- as.binary(c(1,0,0,1,1,1,0,1), logic=TRUE); x
rotate(x,1)
rotate(x,2)
# }

Run the code above in your browser using DataLab