I have a simple script file called test.R. It\'s saved in the working directory. When I go to File > Open > test.R, it opens the file in the edit
test.R
File > Open > test.R
It appears that if you are using RStudio then another option is to use rstudioapi::navigateToFile("test.R")
rstudioapi::navigateToFile("test.R")