Skip to content
New issue

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

eval_tidy() with ... in two-sided formula #1124

Open
lionel- opened this issue Mar 1, 2021 · 3 comments
Open

eval_tidy() with ... in two-sided formula #1124

lionel- opened this issue Mar 1, 2021 · 3 comments
Labels
bug an unexpected problem or unintended behavior tidyeval
Milestone

Comments

@lionel-
Copy link
Member

lionel- commented Mar 1, 2021

rlang::eval_tidy(... ~ 1)
#> Error in rlang::eval_tidy(... ~ 1) : '...' used in an incorrect context

rlang::eval_tidy(1 ~ ...)
Error in rlang::eval_tidy(1 ~ ...) : '...' used in an incorrect context

Causes trouble with data.table: rstudio/shiny#3303 and Rdatatable/data.table#4913

@lionel-
Copy link
Member Author

lionel- commented Mar 9, 2021

This is a limitation of R.

tilde <- function(x, y) list(substitute(x), substitute(y))
tilde(1, ...)
#> Error: '...' used in an incorrect context

ignore <- function(x, y) NULL
ignore(1, ...)
#> Error: '...' used in an incorrect context

The argument application routine of the interpreter checks that the calling environment has dots: https://github.com/wch/r-source/blob/2ab3b85b/src/main/eval.c#L3203-L3204 Only SPECIALSXP functions like ~ can be supplied ... without this check.

@lionel- lionel- added the bug an unexpected problem or unintended behavior label Mar 30, 2021
@lionel-
Copy link
Member Author

lionel- commented Apr 1, 2021

One way forward is #1145.

@lionel- lionel- added this to the future milestone Apr 1, 2021
@stewerner
Copy link

I just stumbled across this in a {shiny} / {data.table} context. Thanks for providing the workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior tidyeval
Projects
None yet
Development

No branches or pull requests

2 participants