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 objects which are returned unchanged by as.Rvector.
as.Rmatrix
, a generic, first converts its argument to a basic R
vector and then applies as.matrix to the result.
as.Rvector(x) as.Rmatrix(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 from as.Rvector is a basic R vector of mode "logical", "integer", "numeric", "complex", "character" or "list". The value from as.Rmatrix is a basic R matrix.
as.vector
for converting an object to an
appropriate vector with all attributes removed and
as.matrix
for converting a vector like object to a
matrix.
x <- 1:2 names(x) <- letters[1:2] as.vector(x) as.Rvector(x) as.Rmatrix(x)