We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is a re-post of this StackOverflow question: https://stackoverflow.com/q/79445476/4550695.
Given a function that defuses its arguments and evaluates them in a data mask:
foo <- function(...) { dots <- rlang::quos(...) expr <- rlang::quo(list(!!!dots)) rlang::eval_tidy(expr, list(a = 1)) } foo(a) #> [[1]] #> [1] 1
Is there a way to make a function that wraps the other function and adds another data mask?
A couple of attempts tried and failed:
bar <- function(...) { dots <- rlang::quos(...) expr <- rlang::quo(foo(!!!dots)) rlang::eval_tidy(expr, list(b = 2)) } try(bar(a, b)) #> Error : object 'b' not found
# Looks promising... bar <- function(...) { eval(substitute(foo(...)), list(b = 2), parent.frame()) } try(bar(a, b)) #> [[1]] #> [1] 1 #> #> [[2]] #> [1] 2 # ... but fails with injection. baz <- function(x) { bar(a, {{ x }}) } try(baz(b)) #> Error : object 'b' not found
The text was updated successfully, but these errors were encountered:
I don't remember exactly but I don't think so.
Sorry, something went wrong.
No branches or pull requests
This is a re-post of this StackOverflow question: https://stackoverflow.com/q/79445476/4550695.
Given a function that defuses its arguments and evaluates them in a data mask:
Is there a way to make a function that wraps the other function and adds another data mask?
A couple of attempts tried and failed:
The text was updated successfully, but these errors were encountered: