Hi,

Yes that warning was because Ricky supplied the output of dput to create the example data, which uses structure(). Creating a data.table that way doesn't initialize the .internal.selfref. I usually just replace the structure() with a data.table() call when pasting code like that.

Have now improved that warning :

" ... At an earlier point, this data.table has been copied by R (or been created manually using structure() or similar). Avoid ..."

and the result looks correct to me in v1.8.7.

Thanks,
Matthew

On 21.01.2013 19:42, statquant3 wrote:
As Matthew is saying, I am using v.1.8.7 (lattest release)
I get a warning:

R>   test.dt[, tc := which(name==order), by=list(ID, name)]
Warning message:
In `[.data.table`(test.dt, , `:=`(tc, which(name == order)), by = list(ID,
:
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. Avoid key<-, names<- and attr<- which in R currently (and oddly) may copy the whole data.table. Use set* syntax
instead to avoid copying: setkey(), setnames() and setattr(). Also,
list(DT1,DT2) will copy the entire DT1 and DT2 (R's list() copies named objects), use reflist() instead if needed (to be implemented). If this message doesn't help, please report to datatable-help so the root cause can
be fixed.




--
View this message in context:

http://r.789695.n4.nabble.com/Crash-when-assigning-column-tp4656168p4656197.html
Sent from the datatable-help mailing list archive at Nabble.com.
_______________________________________________
datatable-help mailing list
[email protected]

https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to