1

I know I can use setwd and all that within the scripts but that breaks the portability of the script - especially when the files I am interested in are on Network drives with different paths on OSX, Windows, etc.

Is there a way that if I call 'Rscript myScript.R' from '~/path/to/my/script' that this will be also be the working directory for the purposes of the script?

Frank P.
  • 503
  • 5
  • 21
  • I'm confused. That should be how it works. Your working directory should be whatever directory you are in when you invoke Rscript. What behavior are you observing? – MrFlick Oct 15 '14 at 20:03
  • I don't think this is a duplicate of the linked answer. (There may be another..) I want to save a file to the directory where I invoke the R script (in my path), and not to the folder where the script is contained. – beroe Oct 09 '18 at 19:45

0 Answers0