title: R: Searching for specific arguments in a row
body: <p>I have 2 data tables. One lets call it df1 only has 2 columns</p>
  
  <pre><code>column1|column2
  3      | 4 
  3      | 6 
  5      | 4 
  </code></pre>
  
  <p>and then I have a df2 which can have 4 or more columns and even more rows</p>
  
  <pre><code>column1|column2|column3|column4
  NA      | 3     |   NA  | NA
  NA      | 5     |   6   | NA
  3       | NA    |   4   | 1
  </code></pre>
  
  <p>and I have to find everyplace where the combination of df1 are represented in df2. In the example I made it would be 1. Since the only combo is in the 3. row in column1 and column3. Also I can only data.table command. Which means I can't use for or if anywhere. I tried using apply</p>
  
  <pre><code>rowcheck&lt;-function(df1, df2){
      apply(df1, 1, function(x) any(apply(df2, 1, function(y) all(y==x))))
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>(do.call(paste0, df1) %in% do.call(paste0, df2))
  </code></pre>
  
  <p>and many more but I just can't seem to get it. Any suggestions or help would be appreciated</p>