Skip to content

strange eval failure in by when there is a condition in i #1356

Closed

Description

@eantonya

Really not sure what's going on, but there is some weird interdependency that's causing an error in eval when there is something in i:

dt = data.table(a = 1:5, b = 1:5, c = 1:5)

col = quote(b)

# this works ok
dt[, a, by = .(eval(col), c)]

# this also works ok
dt[a > 0, a, by = .(b, c)]

# yet this dies
dt[a > 0, a, by = .(eval(col), c)]
#Error in eval(expr, envir, enclos) : object 'b' not found

Tried adding .SD to eval with no effect.

Activity

  1. jangorecki commented on Mar 22, 2020

    @jangorecki
    Member

    related to #1180 but workaround that works there is not applicable here

  2. added
    programming
    and removed on Apr 2, 2020
  3. MichaelChirico commented on Nov 8, 2026

    @MichaelChirico
    Member

    This works fine on current master, AFAICT it was closed by #4981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugprogramming

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions