Skip to content

[R-Forge #5595] setDT has broken internal.selfref when applied on a list #480

@arunsrinivasan

Description

@arunsrinivasan

Submitted by: Eduard Antonyan; Assigned to: Nobody; R-Forge link

l = list(data.frame(a = 1), data.frame(a = 2))
lapply(l, setDT)
# [[1]]
#    a
#1: 1
# 
# [[2]]
#    a
#1: 2

l[[1]][, c := 2]
# Warning message:
# In `[.data.table`(l[[1]], , `:=`(c, 2)) :
#   Invalid .internal.selfref detected and fixed by taking a copy of the whole table so that := can add 
# this new column by reference. At an earlier point, this data.table has been copied by R (or been 
# created manually using structure() or similar). Avoid key<-, names<- and attr<- which in R currently 
# (and oddly) may copy the whole data.table. Use set* syntax instead to avoid copying: ?set, 
# ?setnames and ?setattr. Also, in R<=v3.0.2, list(DT1,DT2) copied the entire DT1 and DT2 (R's 
# list() used to copy named objects); please upgrade to R>v3.0.2 if that is biting. If this message 
# doesn't help, please report to datatable-help so the root cause can be fixed.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions