# Evaluating in a tidy evaluation environment enables all tidy
# features:
env <- tidy_eval_env(data = mtcars)
eval(quote(list(.data$cyl, ~letters)), env)
# However you need to cleanup the environment after
# evaluation. Otherwise the leftover definitions for self-evaluation
# of formulas might cause unexpected results:
fn <- eval(quote(function() ~letters), env)
fn()
tidy_eval_env_cleanup(env)
fn()
Run the code above in your browser using DataLab