[datatable-help] Key dropped when DT[, list(a, b)]
daniel.krizian
daniel.krizian at gmail.com
Fri Nov 22 17:33:26 CET 2013
Hello Steve and thanks for your reply. I am running data.table_1.8.11
Full details below:
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United
Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] timeDate_3010.98 data.table_1.8.11 quantstrat_0.7.8
[4] foreach_1.4.1 blotter_0.8.15
PerformanceAnalytics_1.1.1
[7] FinancialInstrument_1.1 quantmod_0.4-0 Defaults_1.1-1
[10] TTR_0.22-0 xts_0.9-5 zoo_1.7-10
loaded via a namespace (and not attached):
[1] codetools_0.2-8 grid_3.0.2 iterators_1.0.6 lattice_0.20-23
plyr_1.8
[6] reshape2_1.2.2 stringr_0.6.2 tools_3.0.2
On Fri, Nov 22, 2013 at 2:50 PM, Steve Lianoglou-2 [via R] <
ml-node+s789695n4680967h38 at n4.nabble.com> wrote:
> Hi Daniel,
>
> On Fri, Nov 22, 2013 at 6:15 AM, daniel.krizian
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=4680967&i=0>>
> wrote:
> > Hello, I have:
> >
> > DT <- data.table(a=1:10, b=1:10,c=1:10, key=c("a","b"))
> > key(DT) # [1] "a" "b"
> > key(DT[,list(a,b)]) # NULL
> >
> > Note that DT loses its key when I select a subset of columns like above.
> >
> > Is this a (known) bug/ expected result?
>
> The key is retained for me when I run your code:
>
> R> key(DT[,list(a,b)])
> [1] "a" "b"
>
> What version of data.table are you using?
>
> -steve
>
> --
> Steve Lianoglou
> Computational Biologist
> Genentech
> _______________________________________________
> datatable-help mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4680967&i=1>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://r.789695.n4.nabble.com/Key-dropped-when-DT-list-a-b-tp4680965p4680967.html
> To unsubscribe from Key dropped when DT[, list(a, b)], click here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4680965&code=ZGFuaWVsLmtyaXppYW5AZ21haWwuY29tfDQ2ODA5NjV8LTkyNDk4NDY4>
> .
> NAML<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>
>
--
*____________________________*
*Daniel Krizian, CFA, CAIA*
T: +44 74 5372 1101
M: daniel.krizian at gmail.com
uk.linkedin.com/in/danielkrizian
B: quantology.wordpress.com
--
View this message in context: http://r.789695.n4.nabble.com/Key-dropped-when-DT-list-a-b-tp4680965p4680970.html
Sent from the datatable-help mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20131122/e8c996c3/attachment.html>
More information about the datatable-help
mailing list