title: R fastest way to do lookup for vector of strings
body: <p>I have a vector of strings <code>x = c("hello", "world")</code> and another vector <code>y = c("hello", "world", "how", "are", "you")</code>.  I want to see which elements of x are inside y.  For small vector this could easily be done using <code>x %in% y</code>.  However I am looking for a more efficient way to do this - normally we would sort y first in <code>O(n log n)</code> time, then foreach string inside x we can do lookup in <code>O(log n)</code> time.  I am worried that %in% is doing a full pass over y for each x it is looking up.</p>
  
  <p>Is there a way to take advantage of sort and binary search in R?  Or is there a way to build a hashset from y for fast lookup times?</p>