Skip to content

Add DT[a==1][, b:=1] vs DT[a==1, b:=1] to ?":=" #905

@matthieugomez

Description

@matthieugomez

I could not find anything in the documentation about how

DT <- data.table (a = 1)
DT[a==1][, b:=1]

is actually different from

DT <- data.table (a = 1)
DT1 <- DT[a==1]
DT1[,  b := 1]

Maybe the distinction should be written somewhere. This behavior surprised me.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions