This helper function validates a dataframe against the ptype of a recipe.
recipes_ptype_validate(
x,
new_data,
...,
stage = "prep",
call = rlang::caller_env()
)
A recipe
object.
A data.frame. To be patched aganist ptype of x
.
currently not used.
A single character. Must be one of "prep"
or "bake"
. See
details for more. Defaults to "prep"
.
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 the call argument of rlang::abort()
for more
information.
Nothing or an error.
rec <- recipe(mpg ~ disp, data = mtcars)
recipes_ptype_validate(rec, mtcars)