Skip to content

Auto-naming in j inconsistent (multi-statement j) #2478

@MichaelChirico

Description

@MichaelChirico

I find it odd that the following don't give the same output:

DT = data.table(a = 1:3, b = 4:6)

DT[ , .(a, b = b + 1)]
#    a b
# 1: 1 5
# 2: 2 6
# 3: 3 7


DT[ , {
  b = b
  .(a, b = b + 1)
}]
#    V1 b <- Why is a auto-inferred above, but not here?
# 1:  1 5
# 2:  2 6
# 3:  3 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changeissues whose solution would require breaking existing behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions