Flattens a vecvec into a plain R vector by casting all elements to a
common type. This is the inverse of vecvec().
Type resolution follows vctrs coercion rules: when ptype is NULL the
common type is determined automatically from the slots of x via
vctrs::vec_ptype_common(). If no common type can be found (e.g. all slots
are empty), the result falls back to logical().
Arguments
- x
A
vecvecobject.- ptype
A prototype specifying the desired output type, e.g.
character()ornumeric(). IfNULL(the default), the common type is inferred from the elements ofxusingvctrs::vec_ptype_common(), falling back tological()when no common type can be determined. Passing an explicitptypeis useful when you need a guaranteed output type regardless of whatxcontains, or when automatic inference would pick an undesirable type.
Value
A vector of length length(x) and type ptype (or the inferred
common type when ptype = NULL). Positions corresponding to NA indices
in the underlying vecvec structure are filled with NA.
See also
vecvec() to create a vecvec; vctrs::vec_ptype_common() for
the type inference rules; vctrs::vec_cast() for the casting rules.