title: Get filename from read.csv(file.choose( ))
body: <p>I'm wondering if it would be possible to draw out out the filename from a file.choose() command embedded within a read.csv call. Right now I'm doing this in two steps, but the user has to select the same file twice in order to extract both the data (csv) and the filename for use in a function I run. I want to make it so the user only has to select the file once, and then I can use both the data and the name of the file.</p>
  
  <p>Here's what I'm working with:</p>
  
  <pre><code>data &lt;- read.csv(file.choose(), skip=1))
  name &lt;- basename(file.choose())
  </code></pre>
  
  <p>I'm running OS X if that helps, since I think file.choose() has different behavior depending on the OS. Thanks in advance.</p>