| vec_default_cast {vctrs} | R Documentation |
Default cast and ptype2 methods
Description
These functions are automatically called when no vec_ptype2() or
vec_cast() method is implemented for a pair of types.
They apply special handling if one of the inputs is of type
AsIsorsfc.They attempt a number of fallbacks in cases where it would be too inconvenient to be strict:
If the class and attributes are the same they are considered compatible.
vec_default_cast()returnsxin this case.In case of incompatible data frame classes, they fall back to
data.frame. If an incompatible subclass of tibble is involved, they fall back totbl_df.
Otherwise, an error is thrown with
stop_incompatible_type()orstop_incompatible_cast().
Usage
vec_default_cast(x, to, ..., x_arg = "", to_arg = "", call = caller_env())
vec_default_ptype2(x, y, ..., x_arg = "", y_arg = "", call = caller_env())
Arguments
x |
Vectors to cast. |
to |
Type to cast to. If |
... |
For |
x_arg |
Argument name for |
to_arg |
Argument name |
call |
The execution environment of a currently
running function, e.g. |