You could have them spawn a vanilla R session using system instead of the command line:
system('R CMD BATH --vanilla foo.R') Or you could use the local argument to source to evaluate in a new environment that does not inherit from the global environment: source('foo.R', local=new.env(parent=parent.env(.GlobalEnv))) this will prevent the code seeing anything in the global environment, but it could still use functions/objects from any loaded packages. On Thu, May 22, 2014 at 3:00 PM, Charles Geyer <char...@stat.umn.edu> wrote: > For a Google Group about aster models, I want to say that people wanting > help are best advised to provide an example that works as > > R CMD BATCH --vanilla foo.R > > but I realize that many R users have zero idea of how to start R in any way > other than clicking on an icon. Is there a way to start up the standard > mac and windows GUIs or Rstudio with no loaded saved global environment? > (Without making it impossible to go back to what they were doing before?) > > Is there a way to make the source function do the job (ignore everything in > the global environment)? > > What do you tell users about how to make an example that doesn't assume > there is huge amounts of crap that the user doesn't even remember what it > is that is involved? > > Do I just have to explain the command line to all the GUI fans? > > -- > Charles Geyer > Professor, School of Statistics > University of Minnesota > char...@stat.umn.edu > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > 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. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com ______________________________________________ R-help@r-project.org mailing list 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.