Paste function to construct existing data frame name and evaluate in R
<p>I am working with a long list of data frames. </p>

<p>Here is a simple hypothetical example of a data frame:</p>

<pre><code>DFrame&lt;-data.frame(c(1,0),c("Yes","No"))

colnames(DFrame)&lt;-c("ColOne","ColTwo")
</code></pre>

<p>I am trying to retrieve a specified column of the data frame using paste function. </p>

<pre><code>get(paste("DFrame","$","ColTwo",sep=""))
</code></pre>

<p>The get function returns the following error, when trying to retrieve a specified column:</p>

<blockquote>
  <p>Error in get(paste("DFrame", "$", "ColTwo", sep = "")) :object 'DFrame$ColTwo' not found</p>
</blockquote>

<p>When I enter the constructed name of the data frame <code>DFrame$ColTwo</code> it returns the desired output of the second column. </p>

<p>If I reconstruct an example without the '$' sign then I get the desired answer from the get function. For example the code yields 2:</p>

<p>enter code here
    Ans &lt;- 2</p>

<pre><code>get(paste("An","s",sep=""))

[1] 2
</code></pre>

<p>I am looking for the same desired outcome, but struggling to get past the error that the object could not be found.</p>

<p>I also attempted using the following format, but the quotation in the column name breaks the paste function: </p>

<pre><code>paste("DFrame","[,"ColTwo"]",sep="")
</code></pre>

<p>Thank you very much for the input,
Kind regards</p>