I have RStudio working on two different machines: mine and a colleague's.
When I restart R in RStudio with the Ctrl-Shift-F10
shortcut, all my global environment variables go away. Not so for my colleague's, who frequently puts rm(list=ls(all=TRUE))
in our shared code.
Is there an optional parameter somewhere, so that restarting R always clears environment variables?
Disclaimer: this has 100% effectiveness based on a sample size of 5 so far (validated by OP & Badger), but I'm recording it for posterity since other forums where I've seen similar questions (example 1, example 2) don't even have that. :)
Solution: Go to Tools / Global Options / General & change the "Save workspace to .RData on exit" dropdown option to "Never".
Possible interpretation: Even if you chose the 'Ask' option in "Save workspace to .RData on exit", Ctrl-Shift-F10 shortcut won't ask before the session gets restarted. But unless you explicitly chose to NEVER save workspace on exit, RStudio will keep it somewhere just in case. (I'm not sure where, though. There's no .RData file in my working directory corresponding to the restored environment...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With