I would appreciate any help in correcting my misunderstanding of the following:
> substitute(quote(x+a), env = list(a=5)) quote(x + 5) ## as expected > substitute(quote(x+a), env = list2env(list(a=5))) quote(x + 5) ## as expected > ### BUT > .GlobalEnv$a [1] 5 > substitute(quote(x+a), env = .GlobalEnv) quote(x + a) ## unexpected I conclude from this that there is something special about .GlobalEnv that does not allow it to behave as documented for the env argument in ?substitute, to wit: "env: an environment or a list object. Defaults to the current evaluation environment." I would be grateful for any insight, as I am clearly missing something. Note: (though I don't think this matters): > sessionInfo() R version 4.0.3 (2020-10-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 10.16 Cheers to all, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.