R: Make character string refer to an object
<p>I have a large list of files (<code>file1</code>, <code>file2</code>, <code>file3</code>, etc.) and, for each analysis, I want to refer to two files from this list (e.g. <code>function(file1,file2)</code>). When I try to do this using <code>paste0("file", pairs[1,x]</code> I get back the character string <code>"file1"</code> rather than the object <code>file1</code>. </p>

<p>How can I refer to the objects rather than create a character string? </p>

<p>Thank you very much!</p>

<p>Additional comment: </p>

<ul>
<li>pairs is a 2xn matrix where each column is the combination of files for one analysis (e.g. pairs[1,1] = 1 and pairs[2,1] = 2 for the comparison between file1 and file2). </li>
</ul>