[datatable-help] "Chris crash" - followup questions

DM tb2usd at gmail.com
Fri Jan 13 22:08:34 CET 2012


Thanks for all of the help!

By coercing numerics to integers ahead of their usage in data.table, this
has saved a good bit of time.  That may be difficult to determine a priori,
though: it's conceivable that a user may merge two objects, one that has a
variable that uses only integer values (but type is numeric), another with
a full range of fractional values (i.e. continuous, type is numeric).

In any case, as I have a number of merges, sometimes reusing some of the
same input tables, this coercion had a pretty good speedup.

Continuing....

> I've managed to get the code to proceed correctly by replacing the "myDT[,

> > newCol := oldCol]" with:
> >
> >     tmpCol = myDT$oldCol
> >     myDT$newCol = tmpCol
> >
> > This has avoided the issue.
>
> Yes, makes sense. Is myDT the result from a merge()? Or, have you changed
> column names before that point using names(myDT)<-, colnames(myDT) or
> similar?
>


I had two successive merges.  I also did things like   myDT[, newCol :=
oldCol] and myDT[, oldCol := NULL].  I do simple things like this to rename
columns, but I suppose I should use names().  I take advantage of lazy
evaluation and promises.  :)


> $ is copying the whole table, and always will. Once Chris crash bug is
> fixed, please change back to :=.


Will do, thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20120113/5ea07ca1/attachment.htm>


More information about the datatable-help mailing list