Learn R Programming

bit (version 4.5.0)

reverse_vector: Reverse atomic vector

Description

Returns a reversed copy -- with attributes retained.

Usage

reverse_vector(x)

Value

a reversed vector

Arguments

x

an R vector

Details

This is substantially faster than rev

See Also

rev, copy_vector

Examples

Run this code
x <- factor(letters)
rev(x)
reverse_vector(x)
if (FALSE) {
x <- 1:1e7
system.time(rev(x))
system.time(reverse_vector(x))
}

Run the code above in your browser using DataLab