Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

copy_vector

Copy atomic R vector


Description

Creates a true copy of the underlying C-vector – dropping all attributes – and optionally reverses the direction of the elements.

Usage

copy_vector(x, revx = FALSE)

Arguments

x

an R vector

revx

default FALSE, set to TRUE to reverse the elements in 'x'

Details

This can be substantially faster than duplicate(as.vector(unclass(x)))

Value

copied R vector

See Also

Examples

x <- factor(letters)
y <- x
z <- copy_vector(x)
still.identical(x,y)
still.identical(x,z)
str(x)
str(y)
str(z)

bit

Classes and Methods for Fast Memory-Efficient Boolean Selections

v4.0.4
GPL-2 | GPL-3
Authors
Jens Oehlschlägel [aut, cre], Brian Ripley [ctb]
Initial release
2020-08-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.