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

Richard Cotton richierocks at gmail.com
Wed Mar 21 22:51:13 CET 2012


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



More information about the R-devel mailing list