vec_default_cast | R Documentation |
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
AsIs
or sfc
.
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()
returns x
in 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 to tbl_df
.
Otherwise, an error is thrown with stop_incompatible_type()
or
stop_incompatible_cast()
.
vec_default_cast(x, to, ..., x_arg = "", to_arg = "", call = caller_env())
vec_default_ptype2(x, y, ..., x_arg = "", y_arg = "", call = caller_env())
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. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.