title: How to select rows in data.table with dynamically determined column name and cut off limits?
body: <p>I'd like to write a function that selects rows from a data table that fall within a certain range for a dynamically named column. Trying to write this, I find myself unable to do row selection by applying criteria to a dynamically determined column. Here's my examples:</p>
  
  <p>This works fine:</p>
  
  <pre><code>library(data.table)
  dt = data.table(weight=seq(150, 250, 10))
  dt[weight &lt; 200]
  </code></pre>
  
  <p>As does this:</p>
  
  <pre><code>x = 200
  dt[weight &lt; x]
  </code></pre>
  
  <p>But this doesn't work</p>
  
  <pre><code>name = weight
  limit = 200
  dt[eval(name) &lt; limit]
  </code></pre>
  
  <p>What's my workaround here?</p>