Hi,

I see at 
https://r-forge.r-project.org/tracker/index.php?func=detail&aid=1482&group_id=240&atid=978
 that POSIXct values are supported as key.  But I'm unsure how to efficiently 
query them.  Here are my attempts:

> library(lubridate)
> n <- now()
> d <- data.table(t=n+days(1:10), val=runif(10), key='t')
> d[n+days(1)]
Error in `[.data.table`(d, n + days(1)) :
  i has not evaluated to logical, integer or double
> d[n+days(1),]
Error in `[.data.table`(d, n + days(1), ) :
  i has not evaluated to logical, integer or double
> d[list(n+days(1)),]
Error in `[.data.table`(d, list(n + days(1)), ) :
  typeof x.t (integer) != typeof i.V1 (double)


I can query using a boolean, but I assume this is skipping the index on 't'?

> d[t==n+days(1),]
                       t       val
[1,] 2012-09-22 21:06:52 0.2550606


Thanks.


--
Ken Williams, Senior Research Scientist
WindLogics
http://windlogics.com


________________________________
CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended 
recipient(s) and may contain confidential and privileged information. Any 
unauthorized review, use, disclosure or distribution of any kind is strictly 
prohibited. If you are not the intended recipient, please contact the sender 
via reply e-mail and destroy all copies of the original message. Thank you.
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to