title: Command for "Set working directory to source file location"
body: <p>RStudio has a useful feature:</p>
  
  <pre><code>Session -&gt; Set Working Directory -&gt; To Source File Location
  </code></pre>
  
  <p>Is there a way to do this without using the drop down menus?</p>
  
  <p>UPDATE:</p>
  
  <p>maybe a better way of asking is:</p>
  
  <p>is there a command to return the file path of the current r script?</p>
  
  <p>I also found this thread, but the solutions didn't work for me.  Not even Hadley's!</p>
  
  <p><a href="https://stackoverflow.com/questions/1815606/rscript-determine-path-of-the-executing-script">Rscript: Determine path of the executing script</a></p>