[R] Why is rm(list=ls()) bad practice?
bgunter@4567 @end|ng |rom gm@||@com
Thu Jan 21 23:34:22 CET 2021
Do you mean:
rm(list = ls(all = TRUE))
... or something else?
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Thu, Jan 21, 2021 at 2:21 PM J C Nash <profjcnash using gmail.com> wrote:
> In a separate thread Jeff Newmiller wrote:
> > rm(list=ls()) is a bad practice... especially when posting examples. It
> doesn't clean out everything and it removes objects created by the user.
> This query is to ask
> 1) Why is it bad practice to clear the workspace when presenting an
> I'm assuming here that people who will try R-help examples will not run
> them in the
> middle of something else, which I agree would be unfortunates. However,
> one of the
> not very nice aspects of R is that it is VERY easy to have stuff hanging
> around (including
> overloaded functions and operators) that get you into trouble, and indeed
> make it harder
> to reproduce those important "minimal reproducible examples". This
> includes the .RData
> contents. (For information, I can understand the attraction, but I seem to
> have been
> burned much more often than I've benefited from a pre-warmed oven.)
> 2) Is there a good command that really does leave a blank workspace? For
> purposes, it would be useful to have an assured blank canvas.
> This post is definitely not to start an argument, but to try to find ways
> to reduce
> the possibilities for unanticipated outcomes in examples.
> Cheers, JN
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help