It looks like custom attributes are lost by a DF to DT creation, and when the key info for a DT is invalidated, altered, etc...  I ran into this when trying to attach some attribute info to a table that identifies column groups so that a new global variable or passing another param to functions wouldn&#39;t be needed.  This worked nicely, until I had need to either modify some data in the table, which invalidates the key...<br>
<br>Was this a design decision?  If so, why?<br clear="all"><br>Example::<br><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: &#39;DejaVu Sans Mono&#39;; font-size: 12px;"><table class="G1dpdwhmPK ace_text-layer ace_line G1dpdwhmPF" style="font-family: Monaco,&#39;Courier New&#39;,monospace; padding-left: 6px; padding-bottom: 4px; line-height: 1.3; border-style: none; outline-style: none; word-wrap: break-word; white-space: nowrap; cursor: text; color: rgb(255, 255, 255); font-size: 8pt ! important; width: 929px;" cellpadding="0" cellspacing="0">
<tbody><tr><td style="font-family: &#39;DejaVu Sans Mono&#39;; line-height: 1.3; font-size: 8pt ! important; vertical-align: top;" align="left"><pre tabindex="0" class="G1dpdwhmFL" style="font-family: &#39;DejaVu Sans Mono&#39;; font-size: 8pt ! important; outline-style: none; border-style: none; white-space: pre-wrap ! important; margin: 0px; line-height: 1.3;">
<span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">df &lt;- data.frame( id=c(1:5), name= letters[1:5] )<br>
</span><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(df, &#39;testing&#39;) &lt;- &#39;keep me&#39;<br>
</span><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(df, &#39;testing&#39;)<br></span>[1] &quot;keep me&quot;<br>
<span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">dt &lt;- data.table( df )<br></span><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(dt, &#39;testing&#39;)<br>
</span>NULL<br><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(dt, &#39;testing&#39;) &lt;- &#39;keep me&#39;<br>
</span><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(dt, &#39;testing&#39;)<br></span>[1] &quot;keep me&quot;<br>
<span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">df[ 5 , &#39;id&#39; ] &lt;- 53<br></span><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">dt[ 5 , &#39;id&#39; ] &lt;- 53<br>
</span><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(df, &#39;testing&#39;)<br></span>[1] &quot;keep me&quot;<br>
<span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(dt, &#39;testing&#39;)<br></span>[1] &quot;keep me&quot;<br>
<span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">setkey(dt)<br></span><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(dt, &#39;testing&#39;)<br>
</span>NULL<br><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(dt, &#39;testing&#39;) &lt;- &#39;keep me&#39;<br>
</span><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(dt, &#39;testing&#39;)<br></span>[1] &quot;keep me&quot;<br>
<span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">dt[ 5 , &#39;id&#39; ] &lt;- 3<br></span><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">attr(dt, &#39;testing&#39;)<br>
</span>[1] &quot;keep me&quot;<br><span class="G1dpdwhmIL  ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">&gt; </span><span class="G1dpdwhmMK  ace_keyword" style="color: rgb(255, 157, 0);">key(dt)<br></span>NULL<br>
</pre></td></tr><tr><td style="font-family: &#39;DejaVu Sans Mono&#39;; line-height: 1.3; font-size: 8pt ! important; vertical-align: top;" align="left"><table style="width: 929px;" cellpadding="0" cellspacing="0"><tbody><tr>
<td rowspan="1" style="font-family: &#39;DejaVu Sans Mono&#39;; line-height: 1.3; font-size: 8pt ! important; vertical-align: top;" align="left" height="" width="1"><div class="G1dpdwhmIL ace_keyword" style="color: rgb(255, 157, 0); white-space: pre;">
&gt; </div></td></tr></tbody></table></td></tr></tbody></table></span></span><br>-- <br>Sincerely,<br>Thell<br>