title: is.element() for more than one variable
body: <p><code>unique()</code> removes duplicate elements of a vector, and duplicate rows of an array.</p>
  
  <p><code>is.element()</code>, <code>%in%</code>, and <code>match()</code> works only on vectors (or NULL).</p>
  
  <p><strong>Are there any value matching or set operations for multiple variables?</strong> (e.g. rows of an array)</p>
  
  <p>My current workaround is this. It's not quite elegant, and it's obviously sensitive to "_" matching.</p>
  
  <pre><code>match.multiple &lt;- function (x, table, nomatch = NA_integer_, incomparables = NULL) {
    x_vector &lt;- apply(x, 1, paste, collapse="_")
    table_vector &lt;- apply(table, 1, paste, collapse="_")
    match(x_vector, table_vector, nomatch, incomparables)}
  
  is.element.multiple &lt;- "%in.multiple%" &lt;- function (el, set) match.multiple(el, set, 0) &gt; 0
  </code></pre>
  
  <hr>
  
  <p><em>Edit: adding a reproducible example</em></p>
  
  <p>Lets say that you wish to buy a car which has an equal number of forward gears and carburetors. It can be 1-each, 2-each etc. You don't know whether the cars that are <em>available</em> on the market (cf. <code>mtcars</code>) comply with your <em>preferences</em>.</p>
  
  <pre><code>preferences &lt;- cbind(1:8, 1:8)
  available &lt;- cbind(mtcars$gear, mtcars$carb)
  </code></pre>
  
  <p>So you do a matching for both variables: gears <em>and</em> carburetors.</p>
  
  <pre><code>m &lt;- match.multiple(preferences, available)
  m
  # [1] NA NA 12  1 NA NA NA NA
  which(!is.na(m))
  # [1] 3 4
  </code></pre>
  
  <p>These are the number of forward gears and carburetors which come in equal quantities.</p>
  
  <pre><code>willbuy &lt;- m[!is.na(m)]
  mtcars[willbuy, ]
  #     mpg cyl  disp  hp drat   wt  qsec vs am gear carb
  # 1: 16.4   8 275.8 180 3.07 4.07 17.40  0  0    3    3
  # 2: 21.0   6 160.0 110 3.90 2.62 16.46  0  1    4    4
  </code></pre>
  
  <p>And these are catalogue entries for cars that you should consider.</p>