> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Ralf B
> Sent: Thursday, July 29, 2010 10:27 AM
> To: r-help@r-project.org
> Subject: Re: [R] Reset R environment through R command
> 
> With environment I actually meant workspace.
> 
> On Thu, Jul 29, 2010 at 1:22 PM, Ralf B <ralf.bie...@gmail.com> wrote:
> > Is it possible to remove all variables in the current environment
> > through a R command.
> >
> > Here is what I want:
> >
> > x <- 5
> > y < 10:20
> > reset()
> > print(x)
> > print(y)
> >
> > Output should be NULL for x and y, and not 5 and 10:20.
> >
> > Can one do that in R?
> >
> > Best,
> > Ralf
> >
> 

Ralf,

You said you wanted to REMOVE the variables from the workspace, and you have 
received some good replies about how to do that.  However, you then wrote:
  
"Output should be NULL for x and y, and not 5 and 10:20."

Removing the variables is different from setting the variables to NULL.  If you 
remove the variables and then try to print them, they won't output NULL.  You 
will get an error message something like

Error in print(x) : object 'x' not found

So be forewarned if you actually wanted to set the values to NULL.

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204


______________________________________________
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.

Reply via email to