[datatable-help] using J() to select for a value that is in something other than the first key

Steve Lianoglou mailinglist.honeypot at gmail.com
Fri Jan 20 00:26:43 CET 2012


On Thu, Jan 19, 2012 at 6:09 PM, Farrel Buchinsky <fjbuch at gmail.com> wrote:
> Oy gevalt!.Am I correct to believe that the technique is rearranging the
> data.table so that J can accept the input as pertaining to a secondary key?
> That seems as if it is too much work for me and my computer. I will rather
> stick to the vector scan methods for now.

Not the entire data.table, just the key columns.

Depending on how many queries you're going to make against the 2nd key
only, the pay off for your troubles could be anywhere from zero to
mucho. Of course if you simply don't have the RAM to make the idx
data.table in the first place, then that's that.

That's how all indexes work though, no? In a database for instance, if
you have a compound key/index over two or more columns, the index will
only help queries that work any prefix (or whole) part of the key, and
not just any subset elements of it (as you want to do here), right?

HTH,
-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact


More information about the datatable-help mailing list