Skip to content

adding get messes up .SD #3044

Closed
Closed

Description

@eantonya
d = data.table(a = 1, b = 2, c = 3)

d[, {get('b'); c; names(.SD)}, .SDcols = 'b']
[1] "b" "c"

# Expected output
# d[, {b; c; names(.SD)}, .SDcols = 'b']
[1] "b"

Some lexical parsing of the i-expression goes awry when there is get in the expression.

Activity

  1. franknarf1 commented on Sep 12, 2018

    @franknarf1
    Contributor

    You mentioned a similar-looking example here: #1744 (comment)

    dt = data.table(a = 1, b = 2, c = 3)
    
    dt[, {list(a, get('b')); names(.SD)}, .SDcols = 'c']
    #[1] "a" "c"
    

    Maybe not a dupe. (I don't know the internals well enough to guess.)

  2. eantonya commented on Sep 12, 2018

    @eantonya
    ContributorAuthor

    haha, good point - I guess I keep running into this

  3. MichaelChirico commented on Sep 12, 2018

    @MichaelChirico
    Member

    also potential overlap: #2647 #2036 #1548

  4. MichaelChirico commented on Sep 2, 2019

    @MichaelChirico
    Member

    Closed in #3771

    Should add it to the NEWS?

  5. jangorecki commented on Sep 2, 2019

    @jangorecki
    Member

    @MichaelChirico ideally PR having unit test from this issue, and mention NEWS. Unit test just to prevent regression in future, which could eventually be not covered by existing #3771 unit tests.
    Unless existing unit tests are no different from example here.

  6. MichaelChirico commented on Sep 2, 2019

    @MichaelChirico
    Member

    Hard to imagine how it's different from test 2090.1

  7. jangorecki commented on Sep 2, 2019

    @jangorecki
    Member

    @MichaelChirico fine them

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions