title: Getting the name of the data set in an '.rda' file
body: <p>Suppose I have an <code>.rda</code> file created using <code>save()</code>. Example:</p>
  
  <pre><code>save(mydata1, file = "anrdatafile.rda")
  </code></pre>
  
  <p>where, <code>mydata1</code> is a data frame. </p>
  
  <p>I want to write code in <code>R</code> which: (1) loads the 'anrdatafile.rda' file; (2) finds the name of the data frame in that file (3) combines the found data frame with another data frame say <code>mydata2</code>. </p>
  
  <p>How do I achieve step 2? Once I have the name of the data frame in step 2, I can do</p>
  
  <pre><code>combineddata = rbind(mydata1, mydata2)
  </code></pre>
  
  <p>But I don't know how to get that the name of the dataframe in the .rda file is <code>mydata1</code> as a part of a code.</p>
  
  <p>I tried </p>
  
  <pre><code>nameofthedataframe = load('anrdatafile.rda')
  </code></pre>
  
  <p>This assigns the string "mydata1" to the variable "nameofthedataframe", but then how do I get the data in the data frame <code>mydata1</code>?</p>
  
  <p>To clarify, I know I can use the same data frame name that was to used to save the data. However, suppose I forget what the variable was. Or, more importantly, I would have to hard code the variable name in my code. I was wondering whether the program could figure out the name of the data frame during the run time once I gave it the file name. </p>
  
  <p>Thanks. If it is not clear, please let me know. I will try to clarify.  </p>