2

I tried to use rstudioapi::getSourceEditorContext()$path to get the current script path.

However, when I run rscript myscript.r in the dos command, it says, Error: RStudio not running Execution halted.

Any other methods?

Thanks

Chan
  • 3,605
  • 9
  • 29
  • 60
  • Take a look at this https://github.com/jennybc/here_here – Tung Dec 28 '18 at 06:03
  • I believe this question was answered here: https://stackoverflow.com/questions/1815606/rscript-determine-path-of-the-executing-script – Jozef Dec 28 '18 at 07:30

1 Answers1

1

Recently another package was developed called this.path to deal with this problem. I've tried it and it works very well.

David J. Bosak
  • 1,386
  • 12
  • 22