If I understand your question, you can get the environment with sys.frame:

f <- function(code){
    print(sys.frame())
    force(code)
}

f({
 a <- 1
 b <- 2
})

On Wed, Sep 9, 2009 at 10:30 AM, Hadley Wickham <hadley@rice.edu> wrote:

> Hi all,
>
> Is it possible to determine the environment in which a promise will be
> evaluated?  e.g.
>
> f <- function(code) { force(code) }
> f({
>  a <- 1
>  b <- 2
> })
>
> Is there any way to tell from within f that a and b will be created in
> the global environment?
>
> Thanks,
>
> Hadley
>
> --
> http://had.co.nz/
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

