[R] How do delete all R objects out off a function?

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Mar 5 14:11:14 CET 2002



Sven Garbade wrote:
>
> Hi,
>
> how can I remove all R objects in the workspace out of a function?
> rm(list=ls()) doesn't work, and I've tried several pos arguments, but
> nothing worked.

Example:

  anything <- 1
  delete.all <- function()
      rm(list=ls(pos=.GlobalEnv), pos=.GlobalEnv)
  delete.all()
  ls()

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list