Learn R Programming

bit (version 4.0.3)

reverse: Reverse atomic vector

Description

Returns a reversed copy -- with attributes retained.

Usage

reverse(x)

Arguments

x

an R vector

Value

a reversed vector

Details

This is substantially faster than rev

See Also

rev, copy

Examples

Run this code
# NOT RUN {
x <- factor(letters)
rev(x)
reverse(x)
# }
# NOT RUN {
x <- 1:1e7
system.time(rev(x))
system.time(reverse(x))
# }

Run the code above in your browser using DataLab