[R] How can certain variables be automatically excluded from being saved?

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Thu Apr 1 12:20:24 CEST 2021

Hi Ralph,
I suppose you could write a wrapper for q():

byebye<-function(drop=".Random.seed",save = "default", status = 0,
runLast = TRUE) {
 if(drop %in% ls(all.names=TRUE)) rm(drop,pos=1)

warning: untested


On Thu, Apr 1, 2021 at 7:05 PM Ralf Goertz <r_goertz using web.de> wrote:
> Hi,
> after having read here about the "seed problem" I wonder if there is a
> way to automatically exclude certain variables from being saved when the
> workspace image is saved at the end of an interactive session. I have
> been using .First() and .Last() for ages but apparently they are of no
> help as .First() gets called before loading the workspace and .Last()
> after it has been saved. At least the line
> if (".Random.seed" %in% ls(all.names=T)) rm(.Random.seed, pos=1)
> in either of those functions doesn't have the desired effect.
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

More information about the R-help mailing list