[datatable-help] column of named vectors in data.table and possible bug

Matthew Dowle mdowle at mdowle.plus.com
Sat Sep 7 01:42:00 CEST 2013


Just caught up with this thread.
> is it allowed usage of having names for column vectors?
It wasn't intended, no.  It would slow down grouping if it had to 
maintain the names attribute too in the subsets.    data.table is 
intended to be used as a list of plain columns and the internals assume 
that.  names(DT$col) might exist though if data.table() has used a 
reference to an input without taking a copy.  It would then copy on 
first := to that column and drop the names attribute at that point.  
Which is why we might like to leave names there and just not use them.

But I'm thinking data.table() should drop names then to make this 
cleaner.  Despite that meaning a copy of the vector has to be taken if 
it has names.  A copy is taken currently anyway.  But in GNU R 3.1.0,  
with list() no longer copying named inputs,  we can do more on that front.

Matthew



More information about the datatable-help mailing list