title: R - alternative to using sqldf for subsetting
body: <blockquote>
    <p>ID &lt;- c(1:7)</p>
    
    <p>Q1 &lt;- c(12,12,15,14,11,101,1009)</p>
    
    <p>df4 &lt;- data.frame(ID,Q1)</p>
    
    <p>View(df4)</p>
  </blockquote>
  
  <pre><code>ID | Q
  1 | 12
  2 | 12
  3 | 15
  4 | 14
  5 | 11
  6 | 101
  7 | 1009
  </code></pre>
  
  <p>With sqldf I could get a subset where records have Q value of 12,101 or 1009</p>
  
  <blockquote>
    <p>dt4 &lt;- as.data.table(df4) #to convert df4 to table </p>
    
    <p>df5 &lt;- sqldf("select* from dt4 where Q1 in (12,101,1009)")</p>
    
    <p>View(df5)</p>
  </blockquote>
  
  <pre><code>ID | Q
  1 | 12
  2 | 12
  6 | 101
  7 | 1009
  </code></pre>
  
  <p>How can I achieve same without using sqldf?</p>