Can I open an RStudio project, and a specific file in the editor, at the same time, from the commandline

Hi,

I have a use case in which an external tool has to open an R file in RStudio so the user can run the code piece by piece (interactively). This works - I can pass the R file as first parameter to the RStudio executable. However, sometimes the user will have to inspect source code that is located in other R files. Hence I would like the RStudio project to be open as well so he can simply put his mouse cursor on the function, hit F2 and be taken to the proper file location.

Is there a way to open Rstudio from a commandline specifying both what project should be opened and what file should be opened in the editor at the same time?

I was unable to find the commandline parameters for RStudio.exe online, and also tried /help and --help on the prompt without success.

Br,
Jorrit

If you use the path to a project (.Rproj file) as argument, it seems RStudio will open it. Then, you could add lines in a .Rprofile file within that project, that RStudio is supposed to run. In particular, you can use a call such as:

rstudioapi::navigateToFile("myfile.R")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.