[datatable-help] Writing a good "WHERE" statement

John Kerpel john.kerpel2 at gmail.com
Wed Aug 14 17:20:42 CEST 2013


Thx Eduard - it's about 5% faster your way according to rbenchmark.  Hey,
latency is latency....just got a need for speed...

Best,

John


On Wed, Aug 14, 2013 at 9:58 AM, Eduard Antonyan
<eduard.antonyan at gmail.com>wrote:

> you could use Days %in% c(1,5,10,20,30,60,90) instead, or iff Days is the
> first key J(c(1,5,10,20,30,60,90))
>
>
> On Wed, Aug 14, 2013 at 9:30 AM, John Kerpel <john.kerpel2 at gmail.com>wrote:
>
>> Folks:
>>
>> I've been working more and more in data.table and it gets better and
>> better as I learn to use it....
>>
>> So my question is, in the following example, is the Where statement
>> inefficient because I'm using "==" ?  (I just want to use the subsets where
>> days are equal to the values in the statement)
>>
>> Should I do this another way? (Btw, I get exactly the right answer using
>> this approach...)
>>
>> db <- DB4[
>>
>>   Days==1 | Days==5 | Days==10 | Days==20 | Days==30 | Days==60 |
>> Days==90,
>>
>>   j =   {list(v=m_func(x,y,z))},
>>
>>   by= "Date,Indicator,Days"
>>
>>   ]
>>
>> If more detail is necessary, lmk. Date, Indicator, and Days are keys.
>>
>> Best,
>>
>> John
>>
>> _______________________________________________
>> datatable-help mailing list
>> datatable-help at lists.r-forge.r-project.org
>>
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130814/95d1cd2d/attachment.html>


More information about the datatable-help mailing list