From hb at biostat.ucsf.edu  Thu Mar 10 08:44:40 2011
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Wed, 9 Mar 2011 23:44:40 -0800
Subject: [Rd] Create an environment and assign objects to it in one go?
Message-ID: <AANLkTi=n9v0ebCbcsqtZCGQEtUa2nN_rUpoM+0uf0shS@mail.gmail.com>

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.



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