title: Use dataframe as filtering criteria in R
body: <p>I am writing a function that uses a dataframe as filtering criteria for a big dataframe containing model outputs. These are the filtering criteria (as a df):</p>
  <pre><code>      parameter value
  1     alpha   0.1
  2      beta   0.1
  3       eta   0.1
  4      zeta   0.1
  5    lambda   0.5
  6       phi   5.0
  7     kappa   1.0
  </code></pre>
  <p>dput(values)</p>
  <pre><code>    structure(list(parameter = structure(c(1L, 2L, 3L, 7L, 5L, 6L, 
  4L), .Label = c(&quot;alpha&quot;, &quot;beta&quot;, &quot;eta&quot;, &quot;kappa&quot;, &quot;lambda&quot;, &quot;phi&quot;, 
  &quot;zeta&quot;), class = &quot;factor&quot;), value = c(0.1, 0.1, 0.1, 0.1, 0.5, 
  5, 1)), class = &quot;data.frame&quot;, row.names = c(NA, -7L))
  </code></pre>
  <p>And this is how the 'outputs' df looks like:</p>
  <pre><code>     time        w        x         y         z alpha beta eta zeta lambda phi kappa
  1    0.0 10.00000 10.00000 10.000000 10.000000   0.1  0.1 0.1  0.1   0.95   5     1
  1.1  0.1 10.00572 11.04680  9.896057  9.054394   0.1  0.1 0.1  0.1   0.95   5     1
  1.2  0.2 10.01983 12.17827  9.592536  8.215338   0.1  0.1 0.1  0.1   0.95   5     1
  1.3  0.3 10.04010 13.37290  9.112223  7.483799   0.1  0.1 0.1  0.1   0.95   5     1
  1.4  0.4 10.06377 14.60353  8.489174  6.855626   0.1  0.1 0.1  0.1   0.95   5     1
  1.5  0.5 10.08778 15.83982  7.764470  6.323152   0.1  0.1 0.1  0.1   0.95   5     1
  </code></pre>
  <p>dput(outputs)</p>
  <pre><code>    structure(list(time = c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 276.5, 276.6, 
  276.7, 276.8, 276.9, 276.961144437566), w = c(10, 10.0057192322758, 
  10.0198266325956, 10.040096099625, 10.0637654242843, 10.087779652849, 
  -1.71585943177118, -2.04004317987084, -2.56315700921588, -3.56775247519687, 
  -6.37643561014456, -13.828470036737), x = c(10, 11.0467963604334, 
  12.1782709261765, 13.3728962503142, 14.6035317074526, 15.8398164069251, 
  27.2774474452024, 26.3099862348669, 24.8705756934881, 22.3379071188018, 
  15.8960461541267, 3.62452931346518e-144), y = c(10, 9.89605687874935, 
  9.59253574727296, 9.11222320249057, 8.48917353431654, 7.76447036695841, 
  -0.604572230605542, -0.878231815857628, -1.46586965791714, -3.20623046085508, 
  -14.9365932475767, -3.30552834129368e+146), z = c(10, 9.05439359565339, 
  8.21533762023494, 7.48379901688836, 6.85562632179817, 6.3231517466183, 
  42.3149654949179, 43.8836626616462, 46.4372543252026, 51.7183454733949, 
  72.7027555440752, 3.30552834129368e+146), alpha = c(0.1, 0.1, 
  0.1, 0.1, 0.1, 0.1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5), beta = c(0.1, 
  0.1, 0.1, 0.1, 0.1, 0.1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5), eta = c(0.1, 
  0.1, 0.1, 0.1, 0.1, 0.1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5), zeta = c(0.1, 
  0.1, 0.1, 0.1, 0.1, 0.1, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9), lambda = c(0.9, 
  0.9, 0.5, 0.5, 0.9, 0.9, 0.5, 0.9, 0.5, 0.9, 0.5, 0.5
  ), phi = c(5, 5, 5, 5, 5, 5, 20, 20, 20, 20, 20, 20), kappa = c(1, 
  1, 1, 1, 1, 1, 10, 10, 10, 10, 10, 10), ode_outputs..iteration.. = c(NA, 
  NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), row.names = c(&quot;1&quot;, 
  &quot;1.1&quot;, &quot;1.2&quot;, &quot;1.3&quot;, &quot;1.4&quot;, &quot;1.5&quot;, &quot;2916.2765&quot;, &quot;2916.2766&quot;, 
  &quot;2916.2767&quot;, &quot;2916.2768&quot;, &quot;2916.2769&quot;, &quot;2916.2770&quot;), class = &quot;data.frame&quot;)
  </code></pre>
  <p>So it should be something like:</p>
  <pre><code>filtered_outputs &lt;- outputs %&gt;% filter(all rows in column 1 == all values in column 2)
  </code></pre>
  <p>The names under the 'parameter' column correspond to column names in the 'outputs' df. I'd like this to be not hard-coded, so that I can feed in any filtering criteria as a df and the function will filter 'outputs'. I'd like to use dplyr or baseR preferably.</p>