Assigning variable names to an output graph in R <p>I am a new user of R statistics. I am having a huge <code>for</code> loop, of multiple massive files, the loop ends up giving me the result of a graph.</p> <p>Everything is working fine, except with the output file names. what do I want exactly to do? </p> <p>I am using </p> <pre><code>data1 &lt;- read.csv("filepath/filename", header=TRUE, sep=",") data2 &lt;- read.csv("filepath/filename", header=TRUE, sep=",") data3 &lt;- read.csv("filepath/filename", header=TRUE, sep=",") </code></pre> <p>and so on... to read my files.</p> <p>I want the output graph file name to contain the name of the data files and columns from which it was generated. For example:</p> <pre><code>graph1-data1-data3-columnE.pdf </code></pre> <p><strong>Important note:</strong> all the files I am reading have exactly the same column names and number.</p> <p>What command should I use to do this?</p>