-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Recent update causes error in data.table dcast() in Shiny #3303
Comments
This is an interaction between rlang and data.table. It can be reproduced with the following: library(rlang)
library(data.table)
x <- quo({
metrics = c("col.x","col.y")
dt = data.table(x = 1:10, y = "test", col.x = 3, col.y = 4)
melt.dt = melt(dt, measure.vars = metrics, variable.name = "metric")
dt = dcast(melt.dt, ... ~ metric, value.var = "value", fill = NA)
})
eval_tidy(x)
#> Error in check_formula(formula, names(data), valnames) :
#> '...' used in an incorrect context
cc: @lionel- |
Hi @wch - what is ... ~ x
#> ... ~ x
rlang::eval_tidy(rlang::quo(...~x))
#> Error in rlang::eval_tidy(rlang::quo(... ~ x)): '...' used in an incorrect context |
Now tracked in r-lib/rlang#1124. Thanks for the reprex @ColeMiller1. |
Quosures are implemented as formulas for practical/historical reasons. For this reason tidy eval masks contain a special function bound to 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 This is a limitation of R. 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 So I don't see a simple way forward here. |
Describe the problem in detail
Hello! I am having an issue with recent update to either Shiny or data.table, in the data.table dcast() function. I have filed the issue in Rdatatable/data.table#4913, but just to cross-reference. data.table.dcast works fine outside of Shiny.
Example application or steps to reproduce the problem
System details
Browser Version:
Output of
sessionInfo()
:The text was updated successfully, but these errors were encountered: