[R] Question about looking up names
Ross Boylan
ross at biostat.ucsf.edu
Wed Jun 4 01:14:09 CEST 2003
I think I now understand how R looks up names. Could anyone tell me if
I have this right?
First it looks up the nested environments created by lexical scoping.
Then, if it gets to the top (.GlobalEnv) it also looks through the list
of things that have been "attach"ed.
It never looks in the call stack unless you explicitly ask it to, or
mess with the environment frames.
The reason I ask is that it's not entirely clear to me from the "R
Language Definition" how these 3 search spaces (environments/lexical
scoping; call stack/dynamic scoping; attach/search list) are related.
For example the discussion of 3.5.3 ("the call stack") observes that
dynamic scoping "contradicts the default scoping rules in R". I spent
some time trying to figure out how it could do both, before deciding it
doesn't. I suppose the implicit corollary of the contradiction referred
to in 3.5.3--"so we don't do that and you must intervene to achieve
dynamic scoping"--was obvious to the authors. It just wasn't obvious to
me. Since I'm still not sure, I thought I'd check.
Thanks.
--
Ross Boylan wk: (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4 ross at biostat.ucsf.edu
Dept of Epidemiology and Biostatistics hm: (415) 550-1062
University of California, San Francisco
San Francisco, CA 94143-0840
More information about the R-help
mailing list