as.Rvector {externalVector} | R Documentation |

## convert an object to an R basic vector or matrix

### Description

`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.

### Usage

as.Rvector(x)
as.Rmatrix(x)

### Arguments

### Details

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.

### Value

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.

### See Also

`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.

### Examples

x <- 1:2
names(x) <- letters[1:2]
as.vector(x)
as.Rvector(x)
as.Rmatrix(x)

[Package

*externalVector* version 1.0.14

Index]