df_ptype2()
and df_cast()
are the two functions you need to
call from vec_ptype2()
and vec_cast()
methods for data frame
subclasses. See ?howto-faq-coercion-data-frame.
Their main job is to determine the common type of two data frames,
adding and coercing columns as needed, or throwing an incompatible
type error when the columns are not compatible.
Usage
df_ptype2(x, y, ..., x_arg = "", y_arg = "", call = caller_env())
df_cast(x, to, ..., x_arg = "", to_arg = "", call = caller_env())
tib_ptype2(x, y, ..., x_arg = "", y_arg = "", call = caller_env())
tib_cast(x, to, ..., x_arg = "", to_arg = "", call = caller_env())
Arguments
- x, y, to
Subclasses of data frame.
- ...
If you call
df_ptype2()
ordf_cast()
from avec_ptype2()
orvec_cast()
method, you must forward the dots passed to your method on todf_ptype2()
ordf_cast()
.- x_arg, y_arg
Argument names for
x
andy
. These are used in error messages to inform the user about the locations of incompatible types (seestop_incompatible_type()
).- call
The execution environment of a currently running function, e.g.
caller_env()
. The function will be mentioned in error messages as the source of the error. See thecall
argument ofabort()
for more information.- to_arg
Argument name
to
used in error messages to inform the user about the locations of incompatible types (seestop_incompatible_type()
).