title: R substituting a variable when subsetting somedata
body: <p>Consider the following</p>
  
  <pre><code>#make some data
  x&lt;-c("A","B","C","D")
  y&lt;-c(1,2,3,4)
  test1&lt;-as.data.frame(cbind(x,y))
  test1
  
   x y
  1 A 1
  2 B 2
  3 C 3
  4 D 4
  
  #subset 
  test2&lt;-test1[test1$x=="A",]
  test2
  
    x y
  1 A 1
  </code></pre>
  
  <p>Now I would like to be able to substitute a variable for the expression <code>test$x</code> in the subsetting stage, to something like:</p>
  
  <pre><code>blah&lt;-"test1$x"
  test2&lt;-test1[blah=="A",]
  </code></pre>
  
  <p>(Of course, this does not work)</p>
  
  <p>The idea here is I can set this at the top of the script and don't have to search and replace the particular selection criteria each time I wish to change it.</p>
  
  <p>Any suggestions?</p>