rrgui

Are there command line arguments to Rgui.exe for setting the start directory and maximizing the layout?


When I view the Properties of R, on my Windows 11 machine, I see the following:

R properties

Evidently, RGui takes the argument "--sdi". I'm guessing there are also arguments to specify the 'Start in' directory, and to run 'Maximized'. What are those arguments? And is there documentation that specifies all such arguments?


Solution

  • The code that looks at command line options is here: https://github.com/wch/r-source/blob/4a5e54e99fa50a9daa12e8d35b9b6b1ab40bf63a/src/gnuwin32/system.c#L1224 . If you're not familiar with C, the expression !strcmp(*av, "--help") will be true if the current argument is "--help".

    The list of options that I see is as follows: --help, -h, --cd-to-userdocs, --no-environ, --ess, --internet2, --mdi, --sdi, --no-mdi, --debug, --workspace=. As you know, not all of these are documented, so they may be subject to change -- but I don't think Rgui is under active development, just maintenance. It hasn't changed in many years.

    I don't see any arguments to do what you want. However, there are other ways to achieve it. You can set up a profile file (see ?Startup) and run commands when R starts. For example,

    setwd("startdir")
    

    The Rconsole file contains a lot of preferences regarding the display window. You can edit it by hand (it's an ASCII file) or use the preferences dialog to make changes and save it.