<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hello Steve and thanks for your reply. I am running data.table_1.8.11</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">

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 class="gmail_extra"><br><br><div class="gmail_quote">

On Fri, Nov 22, 2013 at 2:45 PM, Steve Lianoglou <span dir="ltr"><<a href="mailto:lianoglou.steve@gene.com" target="_blank">lianoglou.steve@gene.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Daniel,<br>
<div class="im"><br>
On Fri, Nov 22, 2013 at 6:15 AM, daniel.krizian<br>
<<a href="mailto:daniel.krizian@gmail.com">daniel.krizian@gmail.com</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>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>
<span class="HOEnZb"><font color="#888888"><br>
-steve<br>
<br>
--<br>
Steve Lianoglou<br>
Computational Biologist<br>
Genentech<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><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: +44 74 5372 1101</font></div><div style="font-family:arial"><font size="1">M: <a href="mailto:daniel.krizian@gmail.com" target="_blank">daniel.krizian@gmail.com</a></font></div>

<div style="font-family:arial"><a href="http://uk.linkedin.com/in/danielkrizian/" title="View public profile" name="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(http://s.c.lnkd.licdn.com/scds/common/u/images/apps/profile/sprite/sprite_profile_top_card_v7.png);background-color:rgb(246,246,246);background-repeat:no-repeat no-repeat" target="_blank">uk.linkedin.com/in/danielkrizian</a></div>

<div style="font-family:arial"><font size="1">B: <a href="http://quantology.wordpress.com" target="_blank">quantology.wordpress.com</a></font></div></div>
</div></div>