[Rd] Create an environment and assign objects to it in one go?

Henrik Bengtsson hb at biostat.ucsf.edu
Thu Mar 10 08:44:40 CET 2011


Hi,

I've just created:

newEnvEval <- function(..., hash=FALSE, parent=parent.frame(), size=29L) {
  envir <- new.env(hash=hash, parent=parent, size=size);
  evalq(..., envir=envir);
  envir;
} # newEnvEval()

so that I can create an environment and assign objects to it in one go, e.g.

env <- newEnvEval({ a <- 1; b <- 2; });
print(env$a);

Does this already exists somewhere?

/Henrik

PS.



More information about the R-devel mailing list