From richierocks at gmail.com  Wed Mar 21 22:51:13 2012
From: richierocks at gmail.com (Richard Cotton)
Date: Wed, 21 Mar 2012 21:51:13 +0000
Subject: [Rd] Why is there no within.environment function?
Message-ID: <CAPp_+=dLEZzw+ENwTkNmWz-cKZXpQ67NwwUje6EqxWLwMuBufA@mail.gmail.com>

If I want to assign some variables into an environment, it seems
natural to do something like

e <- new.env()
within(e,
    {
      x <- 1:5
      y <- runif(5)
    }
)

This throws an error, since within.environment doesn't exist.? I
realise I can work around it using

as.environment(within(as.list(e),
    {
      x <- 1:5
      y <- runif(5)
    }
))

Just wondering why I can't use within directly with environments.

--
4dpiecharts.com



[Rd] Why is there no within.environment function?
Richard Cotton