R Quick Tips

Get full path to current R script

Are you wondering where is my current R script file located and how to determine the full path?
Here is how to do that in RStudio.

paste(dirname(rstudioapi::getSourceEditorContext()$path), basename(rstudioapi::getSourceEditorContext()$path), sep = '/')

I hope it helps, and please check out other posts about quick R tips.

0 comments on “Get full path to current R script

Leave a Reply

Your email address will not be published. Required fields are marked *