Skip to content

Instantly share code, notes, and snippets.

@djnavarro djnavarro/nse_hell.R
Created May 23, 2019

Embed
What would you like to do?
passing user expressions to inner functions, tidyeval and base
# tidyeval version: tidy_outer returns
# the user expression
#
# expr quotes you
# enexpr quotes user
tidy_outer <- function(x) {
tidy_inner(!!rlang::enexpr(x))
}
tidy_inner <- function(x) {
rlang::enexpr(x)
}
# base version: base_outer returns the
# user expression.
#
# - quote quotes you
# - substitute quotes user
base_outer <- function(x) {
eval(substitute(base_inner(x)))
}
base_inner <- function(x) {
substitute(x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.