Oops; I meant to reply to all, and then forgot after I discarded and rewrote my message a few times. I suspect (although I'm not absolutely certain) that if NULL or similar did the same thing as returning a 0-row data.table with the appropriate number of columns, some operations could be sped up a bit. In those cases, the data.table code wouldn't need to check the number and type of the columns returned.
I suspect that unless someone knows a secret, ultrafast way to iterate through a list of all combinations of a set of items and return the subset of those that match some criteria, that I'm as close to optimal as I'm likely to get right now. ------- Nathaniel Graham [email protected] [email protected] On Tue, Sep 17, 2013 at 5:22 PM, Frank Erickson <[email protected]> wrote: > Well, rbindlist(list()) says "Null data.table" (though it doesn't pass the > is.null() test). Maybe someone else has an idea how to deal with the > no-results case. By the way, it's best to use "reply to all" to make sure > you reply to the mailing list, too; they should be able to see your message > quoted below, though. > > --Frank > > > On Tue, Sep 17, 2013 at 5:03 PM, Nathaniel Graham <[email protected]>wrote: > >> Frank, >> >> Thanks. This seems to have done the trick, so long as I'm careful to >> check for >> zero-length lists and return data.table(i = integer(), j = integer()) in >> those >> cases. Essentially, I have to test every combination of i and j to see >> if it's >> "interesting" or not, and some groups have a lot of rows. At the moment >> I'm >> attacking some other low hanging fruit, like speeding up the comparisons >> I have to do. >> >> As a side note, it would be kind of nice if there was a simple way to clue >> data.table to the fact that there are no rows to return, like returning >> NULL >> or NA or similar. >> >> ------- >> Nathaniel Graham >> [email protected] >> [email protected] >> >
_______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
