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 = "")

vec_default_ptype2(x, y, ..., x_arg = "", y_arg = "")

## Arguments

x Vectors to cast. Type to cast to. If NULL, x will be returned as is. For vec_cast_common(), vectors to cast. For vec_cast(), vec_cast_default(), and vec_restore(), these dots are only for future extensions and should be empty. Argument names for x and to. These are used in error messages to inform the user about the locations of incompatible types (see stop_incompatible_type()). Argument names for x and to. These are used in error messages to inform the user about the locations of incompatible types (see stop_incompatible_type()).