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
:=
Submitted by: Benjamin Barnes; Assigned to: Nobody; R-Forge link
library(data.table) ## data.table 1.9.3 For help type: help("data.table") set.seed(100) nrow <- 100 DT <- data.table(aa = sample(letters[1:5], nrow, replace = TRUE), bb = rnorm(nrow)) sumExpr <- parse(text = "sum(bb, na.rm = TRUE)") meanExpr <- parse(text = "mean(bb, na.rm = TRUE)") ## These work DT[, eval(sumExpr), by = aa] DT[, eval(meanExpr), by = aa] ## This does not work DT[, list(mySum = eval(sumExpr), myMean = eval(meanExpr)), by = aa] ## Error in `[.data.table`(DT, , list(mySum = eval(sumExpr), myMean = eval(meanExpr)), : ## Unsupported type 'expression' ## This works DT[, { out <- list(mySum = eval(sumExpr), myMean = eval(meanExpr)) lapply(out, eval, .SD) }, by = aa]
Perhaps there has been a change of paradigm concerning evaluation of expressions in data.tables - if so, please excuse my ignorance!
The text was updated successfully, but these errors were encountered:
7f21275
arunsrinivasan
No branches or pull requests
Submitted by: Benjamin Barnes; Assigned to: Nobody; R-Forge link
Perhaps there has been a change of paradigm concerning evaluation of expressions in data.tables - if so, please excuse my ignorance!
The text was updated successfully, but these errors were encountered: