title: Pass a condition as a function parameter
body: <p>Is there a way to pass in a  condition as a parameter? For example:</p>
  
  <pre><code>#g is some data'
  
  getIndexesWhen &lt;- function (colname, condition) {
      a &lt;- as.vector(g[,colname])
      a &lt;- which(a fits condition)
  }
  </code></pre>
  
  <p>And then be able to pass in the condition itself, e.g. call something like <code>getIndexesWhen('GDP','&gt; 435')</code>. Or do I need to have separate functions for each case, e.g. =, !=, >, &lt;, etc.?</p>