File: copy_vector.Rd

package info (click to toggle)
r-cran-bit 4.6.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,000 kB
  • sloc: ansic: 5,145; sh: 13; makefile: 6
file content (36 lines) | stat: -rw-r--r-- 854 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/integerutil.R
\name{copy_vector}
\alias{copy_vector}
\title{Copy atomic R vector}
\usage{
copy_vector(x, revx = FALSE)
}
\arguments{
\item{x}{an R vector}

\item{revx}{default \code{FALSE}, set to \code{TRUE} to reverse the elements in 'x'}
}
\value{
copied R vector
}
\description{
Creates a true copy of the underlying C-vector -- dropping all attributes -- and
optionally reverses the direction of the elements.
}
\details{
This can be substantially faster than \code{duplicate(as.vector(unclass(x)))}
}
\examples{
x <- factor(letters)
y <- x
z <- copy_vector(x)
still.identical(x, y)
still.identical(x, z)
str(x)
str(y)
str(z)
}
\seealso{
\code{\link[=clone]{clone()}}, \code{\link[=still.identical]{still.identical()}},  \code{\link[=reverse_vector]{reverse_vector()}}
}