start_fresh | R Documentation |
Removes all currently loaded objects and restarts RStudio, after prompting
the user if they really want to do it. Do NOT change/specify the counter
argument unless you set it to 2
, which forces a restart without prompting.
start_fresh(counter = 0)
counter |
Do not specify unless you set it to |
When I want to restart my RStudio R session anew, I have, in the past, clicked on the broom icon, clicked 'yes' to remove all the current objects in the environment, clicked on 'Session', and then clicked 'Restart R'. This function does all that with one command, and prompts the user to confirm, as a way of being safe.
This code takes inspiration and credit from two sources: Adam Lee Perelman's answer at https://stackoverflow.com/questions/6313079/quit-and-restart-a-clean-r-session-from-within-r, and Romain Francois' nothing
package (https://github.com/romainfrancois/nothing/blob/master/R/zzz.R).
NULL
(because I'm a lazy programmer)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.