RStudio has a useful feature:
Session -> Set Working Directory -> To Source File Location
Is there a way to do this without using the drop down menus?
UPDATE:
maybe a better way of asking is:
is there a command to return the file path of the current r script?
I also found this thread, but the solutions didn't work for me. Not even Hadley's!
You can use :
source("script.R", chdir = TRUE)
and change "script.R" by the name of the file you're interested in.