title: How to supply (logical) operators as arguments to function
body: <p>Is it possible to supply logical (or arithmetic) operators as arguments to R functions. Check <a href="https://stackoverflow.com/questions/36699777/subtraction-method-as-variable">this</a> SO question that share the theme.</p>
  
  <pre><code>f1 &lt;- function(a, b) a&gt;b
  </code></pre>
  
  <p>Then </p>
  
  <pre><code>&gt; f1(1,2)
  [1] FALSE
  </code></pre>
  
  <p>How can I implement an operator that allows me to for instance change the function test, e.g.</p>
  
  <pre><code>f2 &lt;- function(a, b, operator = c('&lt;', '&gt;', '==')) { ... }
  </code></pre>
  
  <p>Then I would like </p>
  
  <pre><code>&gt; f2(1, 2, '&lt;')
  [1] TRUE
  </code></pre>