[R] Query on save.image()

Megh Dal megh700004 at yahoo.com
Thu Oct 14 18:25:11 CEST 2010


Can anyone please tell me how can use save.image() function if it is placed within a function (i.e. some level up from the base level environment)? Here I experimented with following codes:


#rm(list=ls())
fn <- function() {
    x <- rnorm(5)
    save.image("f:/dat.RData")
  }
fn()

However I see that, the object fn() is actually stored in dat.RData file, not that "x". I have gone through the help page and saw there is some argument named "envir"
My question is if I need to supply some value against that argument, then what should be the name of the required environment?

Additionally is there any option to see the hierarchy of different environments at my current R session?

Thanks,



More information about the R-help mailing list