Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

persistent .internal.selfref #1476

Closed
AmitaiPerlstein opened this issue Dec 21, 2015 · 1 comment
Closed

persistent .internal.selfref #1476

AmitaiPerlstein opened this issue Dec 21, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@AmitaiPerlstein
Copy link

R 3.2.3
Can't get rid of Warning message:
In [.data.table(table, , :=("min.in.day", 60 * hour(table$date.time) + :
Invalid .internal.selfref detected and fixed by taking a (shallow) copy of the data.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.

Matt Dowle supposedly referred to the issue in:
http://stackoverflow.com/questions/20687235/warning-invalid-internal-selfref-detected-when-adding-a-column-to-a-data-tab
but the problem is NOT reproduced in
DT <- data.table(x=1:2) # name the object 'DT'
DT.l <- list(DT=DT) # create a list containing one data.table
y <- DT.l$DT # get back the data.table
y[, bla := 1L] # now add by reference

works fine but warning message will occur

The notorious warning is NOT raised

@KillariDev
Copy link

I am facing the same issue here is a minimum working example:

library(data.table)
dt <- data.table(resp=c(1,2,3,4,5))
wide <- copy(list(metrics = dt))$metrics
wide[, id___ := .I]

Warning I get is:
"
Warning message:
In [.data.table(wide, , :=(id___, .I)) :
Invalid .internal.selfref detected and fixed by taking a (shallow) copy of the data.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.
"
sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=Finnish_Finland.1252 LC_CTYPE=Finnish_Finland.1252 LC_MONETARY=Finnish_Finland.1252
[4] LC_NUMERIC=C LC_TIME=Finnish_Finland.1252

attached base packages:
[1] stats graphics grDevices datasets utils methods base

other attached packages:
[1] data.table_1.9.6

loaded via a namespace (and not attached):
[1] tools_3.2.3 chron_2.3-47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants