Skip to content

Programming with env= misses GForce with parametrically-supplied functions #6031

@MichaelChirico

Description

@MichaelChirico
DT=data.table(a=1:2, b=3:4)
DT[, f(b), env = list(f=var), verbose=TRUE]

(currently errors, which #6029 addresses)

Has output:

Argument 'j' after substitute: (function (x, y = NULL, na.rm = FALSE, use)  {     if (missing(use))          use <- if (na.rm)              "na.or.complete"         else "everything"     na.method <- pmatch(use, c("all.obs", "complete.obs", "pairwise.complete.obs", "everything", "na.or.complete"))     if (is.na(na.method))          stop("invalid 'use' argument")     if (is.data.frame(x))          x <- as.matrix(x)     else stopifnot(is.atomic(x))     if (is.data.frame(y))          y <- as.matrix(y)     else stopifnot(is.atomic(y))     .Call(C_cov, x, y, na.method, FALSE) })(b)

Obviously there's no way GForce is going to pick up that this could be gvar once it analyzes that convoluted j.

Are we stuck here? Is there no way to patch in the name var so that the outcome of env substitution becomes j=var(b) and then [ can just do normal processing to find GForce applies?

Metadata

Metadata

Assignees

Labels

GForceissues relating to optimized grouping calculations (GForce)documentationprogrammingparameterizing queries: get, mget, eval, env

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions