Quit and restart a clean R session from within R?
Is there a way I can make an alias, within R, that will execute q()
and then restart a clean R session?
And yes, I am too lazy to type q()
and then the letter R
:)
If you're in RStudio: command/ctrl + shift + F10
You can also use
.rs.restartR()
Depending on how you start R try placing one of these lines into your .Rprofile
file:
makeActiveBinding("refresh", function() { shell("Rgui"); q("no") }, .GlobalEnv)
makeActiveBinding("refresh", function() { system("R"); q("no") }, .GlobalEnv)
Then entering this into the R console:
refresh
will shut down the current session and start up a new one.