I have additional details. It seems that similar methods won't work for recipes. I tried messing around with the sym(x), x, {{ x }}, and !!sym(x). The link you have provided (and after searching a bit online) doesn't seem to contain explicit information on recipes for functional programming purposes.
df = data.frame(text = c('blah blah blah', 'hello, hi, welcome', 'what, why'),
xx = as.factor(c('1', '0', '1')))
myfunc = function(dataa, x){
recc = recipe(as.formula(paste0(x, ' ~ text')), data = dataa) |>
step_tokenize(!!sym(x)) |> # tried some variations
prep() |>
bake(NULL) |>
View()
}
ddff = 'df'
label = 'xx'
myfunc(ddff, label)
#Can't convert <textrecipes_tokenlist> to <character>.
#Run `rlang::last_error()` to see where the error occurred.