[R] More on global environment

Roger D. Peng rpeng at jhsph.edu
Thu Jul 15 21:06:18 CEST 2004

That seems reasonable, although you might use

rm(list = ls(all.names = TRUE))

if you are interested in removing objects whose names begin with a period.


Mike Prager wrote:
> To follow up on my previous question, suppose a user R session wants to 
> unload one workspace and load another within an R session.  Is the 
> following the correct sequence?
> 1.  save.image() to save the current workspace as .Rdata in the current 
> working directory.
> 2.  rm(list=ls()) to remove everything from the workspace.
> 3.  setcwd("xxx") to set the new working directory.
> 4.  load(".Rdata") to load the new workspace.

More information about the R-help mailing list