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

Farrel Buchinsky fjbuch at gmail.com
Thu Jan 19 02:00:48 CET 2012


In setkey it is possible to have multiple columns be a key. There is
however an order to it. To select all the rows by a particular value in the
first key is easy
DT[J("a value from the first key")]

It is even quite easy to select by an AND criteria that incorporates the
second key
DT[J("a value from the first key","a value from the second key")]

But what happens if one wanted to select by only one criteria being a a
value that must be present in the second key? I was hoping to get lucky by
just leaving it blank. But it did not see to work.

DT[J(,"a value from the second key")]

I would love to know what you do.


Farrel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20120118/a21911c2/attachment.htm>


More information about the datatable-help mailing list