How to start a clean "portable" RStudio (obtained from ZIP archive) *without* restoring the last project and ignoring the registry?

I would like to do some teaching with RStudio.

I don't want - for sure -

  1. to use online "web editors", web R and so on (missing packages I need, slow loading)
  2. use containers, like docker or virtual machine. Zero-installation on my student's computers.
  3. to rely on my students' local R versions, the set of installed packages, dependencies and so on.

What I want is to provide them with a stand-alone, totally independent instance of RStudio with "portable R" located in a subdirectory, with own local library. This would be almost entirely "isolated", "sandboxed" from their environments. After the course they could easily delete the whole directory.

I almost set up such an environments by downloading RStudio ZIP and taking portable R (from R Portable - Browse /R-Portable at I can start RStudio from a .BAT file by setting the SET RSTUDIO_WHICH_R=.\R\ ....... environment variable. And it works.

But RStudio always restores their last project. Then it loads their last session, packages - and since these packages don't agree with the R version I use (for a purpose), it "spits" dozens of error messages before it starts. And then they have to close the project anyway. This is not a "zero-interference" approach.

For the R engine I can request "vanilla" model, for instance. Is there any command line switch or any environment variable allowing me to start a completely independent RStudio, ignoring all registry entries, and so on?

Yes, I do know I can uncheck appropriate options in the Tools -> Global Options, but this uses Windows registry I guess. I know it, because when I run the unZIPpped "portable" RStudio it "remembers" things. So this must read the registry...

Briefly - how to launch a clean instance of RStudio?

1 Like

On a windows device. A typical install of Rstudio has configuration data within folder
and will contain a file :
that can contain the preference to disable auto previous project and code loading via :

    "restore_source_documents": false,
    "restore_last_project": false

Thank you, but this would require modifying configuration of my students' computers which I cannot done. Is there any local (RStudio) file, that can be used for this? Or some console parameter? Or some environment variable?

I located these files in my appdata, copied them to the local, portable RStudio installation, disabled the options you mentioned, but it didn't work - because RStudio didn't check for the local version and immediately looked at the appdata.

you can override which folder to load the rstudio preferences from via user level environment variable in windows. so your batch could perhaps could do that.
the env variable would be called XDG_CONFIG_HOME.
If you are launching rstudio with something like start, it could have /WAIT and then you can put commands to revert the environment variable on exit (perhaps).
You would have an issue if the computer was turned off mid your isolated R;
So I suppose you would also provide a second further batch file that simply removes the environment variable, so your students normal Rstudio work will be restored on demand for such situations

Note, also being discussed in Allowing the user to start a "clean" portable local RStudio, without reading any settings from the user's appdata directory · Issue #14445 · rstudio/rstudio · GitHub.

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.