Details

is.vector returns FALSE if x has any attributes
except names. (This is incompatible with S.) On the other hand,
as.vector removes all attributes including names for
results of atomic mode.

Note that factors are not vectors; is.vector returns
FALSE and as.vector converts to a character vector for
mode = "any".

Value

For vector, a vector of the given length and mode. Logical
vector elements are initialized to FALSE, numeric vector
elements to 0, character vector elements to "", raw
vector elements to nul bytes and list elements to NULL.
All attributes are removed from the answer if it is of an atomic mode.

Note

as.vector and is.vector are quite distinct from the
meaning of the formal class "vector" in the methods
package, and hence as(x, "vector") and
is(x, "vector").

modes of "symbol", "pairlist" and
"expression" are allowed but have long been undocumented.