title: how can i tell select() in dplyr that the string it is seeing is a column name in a data frame
body: <p>I tried searching but didn't find an answer to this question. </p>
  
  <p>I'm trying to use the select statement in dplyr but am having problems when I try to send it strings. My question is, how do i tell select() that the string that it is seeing is a column name in the data frame?</p>
  
  <p>e.g. this works fine</p>
  
  <pre><code>select(df.main.scaled, var1, var3)
  select(df.main.scaled, var2, var4)
  </code></pre>
  
  <p>but this does not work:</p>
  
  <pre><code>select(df.main.scaled, names.gens[i,1], names.gens[i,2])
  </code></pre>
  
  <p>where </p>
  
  <pre><code>&gt; names.genx &lt;- c("var1","var2")
  &gt; names.geny &lt;- c("var3","var4")
  &gt; names.gens &lt;- cbind(names.genx, names.geny)
  &gt; names.gens
       names.genx names.geny
  [1,] "var1"     "var3"    
  [2,] "var2"     "var4"  
  </code></pre>
  
  <p>To be clear, all the strings in names.gens are column names in the data frame. </p>
  
  <p>Thanks.</p>