[R] terminology for frames and environments
    Peter Dalgaard 
    p.dalgaard at biostat.ku.dk
       
    Mon Jun 14 23:53:02 CEST 2004
    
    
  
Gabor Grothendieck <ggrothendieck at myway.com> writes:
> Thomas Lumley <tlumley <at> u.washington.edu> writes:
> 
> > The distinction between "environment" and "frame" is important. The frame
> > is what you find things in with get(, inherits=FALSE) and the environment
> > uses get(, environment=TRUE).
> 
> The thing I find odd about this one is that if we have:
> 
> e <- new.env()
> e$x <- 1
> f <- new.env(parent=e)
> f$x  # gives an error
(Actually not. I get NULL)
> then I would have expected x to be returned since f is an environment
> and x is in that environment.  On the other hand, if an environment
> is defined to be the same as a frame (and there is some other word for 
> an environment and its ancestors) then the above notation makes sense.
Why?  f$x is documented to be basically equivalent to
get("x",f,inherits=FALSE). In contrast,
> evalq(x,f)
[1] 1
works fine.
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
    
    
More information about the R-help
mailing list