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 example? 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 testing 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@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.