R Studio Workspace

I have about 64 objects loaded in my workspace for R-Studio.
I believe this is why R-Studio takes 2 minutes to load up/ or sometimes, it fails to even open.
As a result, I tried,

rm(list = ls())

However, this didn't erase all objects permanently as these same objects appear the next time I open R Studio.
Any thoughts?

I fixed this by looking at @atiretoo's post:

It does, as long as you’re not sharing that script! Bad behavior to start by clobbering someone’s workspace! @jennybryan had a good post/tweet/something about this, I think.

If you’re using RStudio, there’s a cleaner solution. Go to Tools | Global Options | General and untick one box and change a dropdown:
image
This way you get the same behavior as rm(list=ls()) but your scripts will play well when shared with others.
I didn’t figure this out on my own but I can’t remember where I heard it suggested as a good practice. Probably on twitter.

1 Like