title: How to handle paths in R when developing in a different local location than a remote location
body: <p>I've developed a script in RStudio and I pushed it to a remote server. The file is located within a shiny app, I do not have shiny-server set up locally and I just developed it in let's say <code>~/projects/app</code> and then I pushed it to a remote repo which is located in <code>/srv/shinyserver/</code>. </p>
  
  <p>When I was developing locally in R studio, I simply set the working directory and used relative paths for accessing other files. But on the remote server, I want to run the Rscript from a cron job and the relative paths won't work. The absolute paths aren't the same on the servers so it's not as simple as just switching to absolute. </p>
  
  <p>What is the best way to reference these files and continue local and remote development?</p>
  
  <p>In python I have worked around this problem in the past by setting a variable to the location of the file being called:</p>
  
  <pre><code>import os 
  dir_path = os.path.dirname(os.path.realpath(__file__))
  </code></pre>
  
  <p>Edit: I think the '<a href="https://github.com/jennybc/here_here" rel="nofollow noreferrer">here</a>' package might be what I'm looking for. If you have any other solutions please let me know</p>
  
  <p>Edit 2: nevermind, <code>here</code> doesn't work from crons, which makes the path <code>/home/[user]</code> instead of <code>/srv/shinyserver/app</code> so still looking for an answer on this</p>