title: How do I get the absolute path of an input file in R
body: <p>I am using Rscript to plot some figures from a given CSV file in some directory, which is not necessarily my current working directory. I can call it as follows:</p>
  
  <pre><code>./script.r ../some_directory/inputfile.csv
  </code></pre>
  
  <p>Now I want to output my figures in the same directory (../some_directory), but I have no idea how to do that. I tried to get the absolute path for the input file because from this I could construct the output path, but I couldn't find out how to do that.</p>