Restart R within Rstudio Restart R within Rstudio r r

Restart R within Rstudio


In Rstudio, you can restart the R session by:

command/ctrl + shift + F10 

You can also use:

.rs.restartR()


RStudio has this undocumented rs.restartR() which is supposed to do just that: restarting R.

However, it does not unload the packages that were loaded, nor does it clean the environment, so that I have some doubts about if it restarts R at all.


If you use RStudio, use the menu item Session > Restart R or the associated keyboard shortcut Ctrl+Shift+F10 (Windows and Linux) or Command+Shift+F10 (Mac OS). Additional keyboard shortcuts make it easy to restart development where you left off, i.e. to say “re-run all the code up to HERE”:

In an R script, use Ctrl+Alt+B (Windows and Linux) or Command+Option+B (Mac OS)In R markdown, use Ctrl+Alt+P (Windows and Linux) or Command+Option+P (Mac OS)If you run R from the shell, use Ctrl+D or q() to quit, then restart R.