Quoting the NEWS (1. bug fix in version 1.9.6):
if (TRUE) DT[,LHS:=RHS]
no longer prints, #869 and #1122. Tests added.
To get this to work we've had to live with one downside: if a :=
is
used inside a function with no DT[]
before the end of the function,
then the next time DT
or print(DT)
is typed at the prompt, nothing
will be printed. A repeated DT
or print(DT)
will print. To avoid this:
include a DT[]
after the last :=
in your function. If that is not
possible (e.g., it's not a function you can change) then DT[]
at the
prompt is guaranteed to print.
<-
is a function. Of course, you shouldn't use <-
there at all. It creates an unnecessary copy (since :=
modifies the data.table column in place) and is therefore inefficient.