This function should typically be called from the default vec_cast() method for your class, e.g. vec_cast.myclass.default(). It does two things:

vec_default_cast(x, to, x_arg = "x", to_arg = "to")

Arguments

x

Vectors to cast.

to

Type to cast to. If NULL, x will be returned as is.

x_arg

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()).

to_arg

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()).