title: How can I build an inverted index from a data frame in R?
body: <p>Say I have a data frame in R : <code>data.frame(x=1:4, y=c("a b c", "b", "a c", "c"))</code></p>
  
  <pre><code>  x     y
  1 1 a b c
  2 2     b
  3 3   a c
  4 4     c
  </code></pre>
  
  <p>Now I want to build a new data frame, an inverted index which is quite common in IR or recommendation systems, from it:</p>
  
  <pre><code>y    x
  a    1 3
  b    1 2
  c    1 3 4
  </code></pre>
  
  <p>How can I do this in an efficient way? </p>