0

This is related to the Note section of assignment by reference using :=

If the value is assigned to a name, then no output is shown if the name is entered into the console directly afterwards. Entering it a second time shows the output. Why is that so?

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

# with a filter as in the Note section
DT <- data.table(a = 1)
ans <- DT[a == 1][, b := 1]
ans
kingddd
  • 131
  • 4

0 Answers0