From website: In step_percentile(), terms = terms is passed on to step_percentile_new(). This will set terms member of the step to function stats::terms. However, in prep.step_percentile(), x$terms is used in recipes_eval_select() as the first argument, which is expected to be a quosure list to select variables to apply the step. Since x$term = stats::terms is a function, this will throw an error:
Error in enexpr(expr) :
Can't splice an object of type `closure` because it is not a vector
I changed the function call to step_percentile_new() to follows (note the change terms = rlang::enquos(...), and it worked as expected:
step_percentile_new(
terms = rlang::enquos(...),
trained = trained,
role = role,
ref_dist = ref_dist,
options = options,
skip = skip,
id = id
)
From website: In
step_percentile()
,terms = terms
is passed on tostep_percentile_new()
. This will setterms
member of the step to functionstats::terms
. However, inprep.step_percentile()
,x$terms
is used inrecipes_eval_select()
as the first argument, which is expected to be a quosure list to select variables to apply the step. Sincex$term = stats::terms
is a function, this will throw an error:I changed the function call to
step_percentile_new()
to follows (note the changeterms = rlang::enquos(...)
, and it worked as expected: