-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
programmingparameterizing queries: get, mget, eval, envparameterizing queries: get, mget, eval, env
Description
Using dynamically determined symbol in j can be quite annoying (as discussed in #633, #2589).
I'm not sure if the following idea makes sense, which seems easier to implement and nicer to look at for me.
library(data.table)
dt <- data.table(id = rep(1:2, 5), x1 = rnorm(10), x2 = rnorm(10), y1 = rnorm(10), y2 = rnorm(10))
dt[, .(xsum = sum(x), ysum = sum(y)), by = id, alias = c(x = "x1", y = "y2")]In the above example, if a new argument like alias is introduced, a named character vector would give fixed names to dynamically determined symbols, which makes it much easier to use them in j.
Some new problems may occur such as when x or y are already defined in dt. But the syntax looks much cleaner if the dynamic symbols can be determined outside dt.
jangoreckijangorecki
Metadata
Metadata
Assignees
Labels
programmingparameterizing queries: get, mget, eval, envparameterizing queries: get, mget, eval, env