copy_vector: Copy atomic R vector

Description Usage Arguments Details Value See Also Examples

View source: R/integerutil.R

Description

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

Usage

1
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

clone, still.identical, reverse_vector

Examples

1
2
3
4
5
6
7
8
x <- factor(letters)
y <- x
z <- copy_vector(x)
still.identical(x,y)
still.identical(x,z)
str(x)
str(y)
str(z)

bit documentation built on Aug. 4, 2020, 9:06 a.m.