3

In this vignette it says filtering rows in a data.table is much faster when setting a key and using binary search as opposed to vector scanning. Sticking to the example in the vignette

setkey(flights, origin)
flights[.("JFK")]

is supposed to be much faster than

flights[origin == "JFK"]

Is there a similarly nice syntax for dropping rows instead of keeping rows? That is, what is the counterpart of the first solution for the case of

flights[origin != "JFK"]

?

paljenczy
  • 4,779
  • 8
  • 33
  • 46
  • My understanding is that "auto-indexing" makes the bits without `setkey` fine as far as speed goes. I'm not sure exactly what triggers auto-indexing nor where it's documented, though. – Frank Jun 29 '15 at 18:30
  • [eddi](http://stackoverflow.com/users/817778/eddi) it works, thanks! Does it bring the speed improvement? (I have not yet had time to experiment with it.) – paljenczy Jun 29 '15 at 20:03

0 Answers0