Search code examples
rrstudiorprofile

Temporarily Disable Rprofile


How do I temporarily disable Rprofile. short of renaming the file? Is there an elegant way to toggle my Rprofile on and off upon startup of RStudio?


Solution

  • This is easily done without RStudio by launching R from the command line. You can either launch R with the --no-init-file flag to load without .Rprofile.

    Another option is to have an alternative .Rprofile in the folder you are launching R from. For example, I have a folder called "update_R" where I have an .Rprofile that doesn't load any packages on startup and runs update.packages. At startup, R first looks for .Rprofile.site, then for .Rprofile in the working directory, then finally for .Rprofile in the user directory.

    For RStudio, the only way to do this appears to be to use a Project and to place a special .Rprofle within the project folder. Hope this helps.