powered by
Creates a true copy of the underlying C-vector -- dropping all attributes -- and optionally reverses the direction of the elements.
copy_vector(x, revx = FALSE)
copied R vector
an R vector
default FALSE, set to TRUE to reverse the elements in 'x'
FALSE
TRUE
This can be substantially faster than duplicate(as.vector(unclass(x)))
duplicate(as.vector(unclass(x)))
clone, still.identical, reverse_vector
clone
still.identical
reverse_vector
x <- factor(letters) y <- x z <- copy_vector(x) still.identical(x,y) still.identical(x,z) str(x) str(y) str(z)
Run the code above in your browser using DataLab