title: How to use a string variable to select a data frame column using $ notation
body: <p>From the reading I've been doing with R, I can select a column in a data frame by either of these two methods:  <code>frame[,column]</code> or <code>frame$column</code>.  However, when I have a string as a variable, it works only in the first.  In other words, consider the following:</p>
  
  <p>I have a data frame, tmp, a subset of a larger data frame of question responses.  V1 is the responder's id, Q5.3 is the response, a 1 or 0:</p>
  
  <pre><code>            V1 Q5.3
  2 R_bdyKkzWcvBxDFTT    1
  3 R_41wnKUQcM8mUW2x    0
  4 R_2ogeykkgbH2e4RL    1
  5 R_8D4jzMBfYO0M0ux    1
  6 R_3KPgP2pxWROnip7    1
  
  str(tmp)
  
  'data.frame':   5 obs. of  2 variables:
       $ V1  : Factor w/ 364 levels "R_0039orNoOoWaDQx",..: 256 116 70 201 95
       $ Q5.3: num  1 0 1 1 1
  </code></pre>
  
  <p>Now, I define a variable x, that holds the string of the name of one of the columns.</p>
  
  <pre><code>x&lt;-"Q5.3"
  </code></pre>
  
  <p>tmp[,x] returns what I think it should return:</p>
  
  <pre><code>tmp[,x]
  
  [1] 1 0 1 1 1
  </code></pre>
  
  <p>tmp$"Q5.3" returns what I think it should return:</p>
  
  <pre><code>tmp$"Q5.3"
  
  [1] 1 0 1 1 1
  </code></pre>
  
  <p>tmp$x however returns</p>
  
  <pre><code>tmp$x
  
  NULL
  </code></pre>
  
  <p>How can I tell R to interpret tmp$x as tmp$"Q5.3".</p>