[datatable-help] Preserving comments in [.data.table?

Allan Engelhardt allane at cybaea.com
Tue Sep 11 13:50:32 CEST 2012


On 11/09/12 12:32, Matthew Dowle wrote:
>> [...]
>> I think we want column attributes. As in: all of them. The comment is
>> just one attribute. R uses attributes for all sorts of sneaky things so
>> I think it is a bad idea if we lose some of them some of the time.
> Oh I see. Please file a bug.report(package="data.table") something like:
> "Column attributes (such as 'comment') are sometimes lost."

Done as #2270

> [...]
> we'd need setcomment() [or
> setlabel(), or both] to avoid that copy; adding to the set* family.
>> A set attributes that allows setting column attributes may suffice.
> Already exists: try setattr(). Works on anything.

Documentation says it only works for x= of type data.table. The column 
of a data.table will rarely be of this type....? I think we need 
setcolumnattr() or similar to do what you want. But copying a single 
column is not *that* bad [1], so I suggest fixing the lost attributes is 
the first priority.

Allan
[1] You would typically set the attributes when you create the column 
and then leave them well alone. It is only because you keep deleting 
them that I keep going back and re-setting them.



More information about the datatable-help mailing list