title: Using logical operators stored in character variables while subsetting data frame in R
body: <p>My R script get three inputs from user which are read into var1, var2 and var3.</p>
  
  <p>I am trying to perform a simple subset operation for data frame. The pseudocode of my thinking is 
  shown below:</p>
  
  <pre><code>subset_data_frame&lt;- dat[ dat[[var1]] var2 var3 , ]
  
  where     var1= column name from dat
            var2= can be any of the logical operator like '==', '&gt;', '&lt;' etc.
            var3= numeric value    
  </code></pre>
  
  <p>But this doesn't work because of the way I used the logical operator from var2.</p>
  
  <p>Please suggest me an alternate way to get out of this problem.</p>