Skip to content

.SD is locked for DT[, DT2[.SD]] joins #1926

@franknarf1

Description

@franknarf1

Based on an SO question, I was trying something like...

library(data.table)
DT = data.table(id = 1:2, v = 3:4)
DT2 = data.table(id = 1, x = 5)
DT[id == 1, DT2[.SD, on="id"]]

Error in set(i, j = lc, value = newval) :
.SD is locked. Updating .SD by reference using := or set are reserved for future use. Use := in j directly. Or use copy(.SD) as a (slow) last resort, until shallow() is exported.

I wasn't expecting to see this error since I'm not using set.

Other SO posts to update when fixed:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions