You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library(data.table)
data.table(a=c(1,1,2))[, unique(.SD)][, b:=5]
# Error in `[.data.table`(data.table(a = c(1, 1, 2))[, unique(.SD)], , `:=`(b, : # .SD is locked. Using := in .SD's j is reserved for possible future use; a tortuously flexible way to modify by group. Use := in j directly to modify by group by reference.
unique(.SD)
makes the lock on data.table:While this working
As the
unique(.SD)
is not a by reference operation, such:=
should work IMO.The text was updated successfully, but these errors were encountered: