title: get filename and path of `source`d file
body: <p>How can a <code>source</code>d or <code>Sweave</code>d file find out its own path? </p>
  
  <p>Background:</p>
  
  <p>I work a lot with .R scripts or .Rnw files.
  My projects are organized in a directory structure, but the path of the project's base directory frequently varies between different computers (e.g. because I just do parts of data analysis for someone else, and their directory structure is different from mine: I have projects base directories ~/Projects/StudentName/ or ~/Projects/Studentname/Projectname and most students who have just their one Project usually have it under ~/Measurements/ or ~/DataAnalysis/ or something the like - which wouldn't work for me).</p>
  
  <p>So a line like </p>
  
  <pre><code>    setwd (my.own.path ()) 
  </code></pre>
  
  <p>would be incredibly useful as it would allow to ensure the working directory is the base path of the project regardless of where that project actually is. Without the need that the user must think of setting the working directory.</p>
  
  <p>Let me clarify: I look for a solution that works with pressing the editor's/IDE's <code>source</code> or <code>Sweave</code> Keyboard shortcut of the unthinking user. </p>