<div dir="ltr">This was fixed relatively recently in revision 999, so try updating your build.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 22, 2013 at 10:33 AM, daniel.krizian <span dir="ltr"><<a href="mailto:daniel.krizian@gmail.com" target="_blank">daniel.krizian@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><div dir="ltr">Hello Steve and thanks for your reply. I am running data.table_1.8.11<div><br></div><div>
Full details below:<div><br></div><div><div>> sessionInfo()</div><div>R version 3.0.2 (2013-09-25)</div><div>Platform: x86_64-w64-mingw32/x64 (64-bit)</div>
<div><br></div><div>locale:</div><div>[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 </div><div>[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C </div>
<div>[5] LC_TIME=English_United Kingdom.1252 </div><div><br></div><div>attached base packages:</div><div>[1] stats graphics grDevices utils datasets methods base </div><div><br></div><div>other attached packages:</div>
<div> [1] timeDate_3010.98 data.table_1.8.11 quantstrat_0.7.8 </div><div> [4] foreach_1.4.1 blotter_0.8.15 PerformanceAnalytics_1.1.1</div><div> [7] FinancialInstrument_1.1 quantmod_0.4-0 Defaults_1.1-1 </div>
<div>[10] TTR_0.22-0 xts_0.9-5 zoo_1.7-10 </div><div><br></div><div>loaded via a namespace (and not attached):</div><div>[1] codetools_0.2-8 grid_3.0.2 iterators_1.0.6 lattice_0.20-23 plyr_1.8 </div>
<div>[6] reshape2_1.2.2 stringr_0.6.2 tools_3.0.2 </div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Fri, Nov 22, 2013 at 2:50 PM, Steve Lianoglou-2 [via R] <span dir="ltr"><<a href="http://user/SendEmail.jtp?type=node&node=4680970&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span> wrote:<br>
</div><blockquote style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><div class="im"><div>
Hi Daniel,
<br><br>On Fri, Nov 22, 2013 at 6:15 AM, daniel.krizian
<br></div></div><div class="im"><div><<a href="http://user/SendEmail.jtp?type=node&node=4680967&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>> wrote:
<br>> Hello, I have:
<br>>
<br>> DT <- data.table(a=1:10, b=1:10,c=1:10, key=c("a","b"))
<br>> key(DT) # [1] "a" "b"
<br>> key(DT[,list(a,b)]) # NULL
<br>>
<br>> Note that DT loses its key when I select a subset of columns like above.
<br>>
<br>> Is this a (known) bug/ expected result?
<br><br></div><div>The key is retained for me when I run your code:
<br><br>R> key(DT[,list(a,b)])
<br>[1] "a" "b"
<br><br>What version of data.table are you using?
<br><br>-steve
<br><br>--
<br>Steve Lianoglou
<br>Computational Biologist
<br>Genentech
<br></div>_______________________________________________
<br>datatable-help mailing list
<br></div><a href="http://user/SendEmail.jtp?type=node&node=4680967&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" rel="nofollow" link="external" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
<br>
<br>
<hr noshade size="1" color="#cccccc">
<div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
<div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
<a href="http://r.789695.n4.nabble.com/Key-dropped-when-DT-list-a-b-tp4680965p4680967.html" rel="nofollow" link="external" target="_blank">http://r.789695.n4.nabble.com/Key-dropped-when-DT-list-a-b-tp4680965p4680967.html</a>
</div>
<div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
To unsubscribe from Key dropped when DT[, list(a, b)], <a rel="nofollow" link="external">click here</a>.<br>
<a href="http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" link="external" target="_blank">NAML</a>
</div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div class="im"><div style="font-family:arial;font-size:small"><b style="font-size:x-small">____________________________</b></div><div style="font-family:arial;font-size:small">
<b style="font-size:x-small">Daniel Krizian, CFA, CAIA</b><br></div><div style="font-family:arial"><font size="1">T: <a href="tel:%2B44%2074%205372%201101" value="+447453721101" target="_blank">+44 74 5372 1101</a></font></div>
</div><div style="font-family:arial"><font size="1">M: <a href="http://user/SendEmail.jtp?type=node&node=4680970&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a></font></div>
<div style="font-family:arial"><a href="http://uk.linkedin.com/in/danielkrizian/" title="View public profile" name="14280a94674bad6c_SafeHtmlFilter_SafeHtmlFilter_SafeHtmlFilter_webProfileURL" style="font-size:x-small;margin:0px 10px 0px 0px;padding:0px 0px 0px 19px;border:0px;outline:0px;font-family:Arial,sans-serif;vertical-align:middle;text-decoration:none;color:rgb(102,102,102);line-height:13.1875px;display:inline-block;zoom:1;background-image:url();background-color:rgb(246,246,246);background-repeat:no-repeat no-repeat" rel="nofollow" link="external" target="_blank">uk.linkedin.com/in/danielkrizian</a></div>
<div style="font-family:arial"><font size="1">B: <a href="http://quantology.wordpress.com" rel="nofollow" link="external" target="_blank">quantology.wordpress.com</a></font></div></div>
</div>
<br><hr align="left" width="300">
View this message in context: <a href="http://r.789695.n4.nabble.com/Key-dropped-when-DT-list-a-b-tp4680965p4680970.html" target="_blank">Re: Key dropped when DT[, list(a, b)]</a><div class="HOEnZb"><div class="h5"><br>
Sent from the <a href="http://r.789695.n4.nabble.com/datatable-help-f2315188.html" target="_blank">datatable-help mailing list archive</a> at Nabble.com.<br></div></div><br>_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br></blockquote></div><br></div>