title: Is there a quick way of filtering rows of a data.frame more than once?
body: <p>I have a dataframe <code>xd</code> from which I wish to filter data for id=1,2, but with 1 and 2 both repeated twice. </p>
  
  <pre><code>set.seed(12)
  xd &lt;- data.frame(id = sort(sample(3,20, rep=TRUE)), y = rnorm(20))
  fxd &lt;- subset(xd, subset = id %in% c(1,2,1,2)) # doesn't work
  str(fxd)
  </code></pre>
  
  <p>However, this doesn't work because it only selects id=1 and id=2 only once. Is there any quick way of getting around it?</p>