as.Rvector {externalVector} | R Documentation |
as.Rvector
, a generic, attempts to coerce its argument into a
basic R vector of a convenient mode. All attributes of x
are
preserved.
Default methods are provided for basic R vectors which are returned unchanged.
as.Rvector(x)
x |
An object |
This preserves all the non-slot attributes of the object x
when converting to a basic R vector. In addition, if any of
dim(x)
, dimnames(x)
, names(x)
is not
NULL
, the corresponding attribute in the result is also set.
The value is a basic R vector of mode "logical", "integer", "numeric", "complex", "character" or "list".
as.vector
for converting an object to an
appropriate vector with all attributes removed.
x <- 1:2 names(x) <- letters[1:2] as.vector(x) as.Rvector(x)