[R] Concepts question: environment, frame, search path
Duncan Murdoch
murdoch at stats.uwo.ca
Wed May 2 12:56:34 CEST 2007
On 01/05/2007 11:34 AM, Prof Brian Ripley wrote:
> On Tue, 1 May 2007, Duncan Murdoch wrote:
>
>> On 01/05/2007 12:29 AM, Graham Wideman wrote:
[...]
>>> Refman p122: "Environments consist of a frame, or collection of named
>>> objects, and a pointer to an enclosing environment."
>>>
>>> Is the "or" here explaining parenthetically that a frame is a collection of
>>> named objects, or is separating too alternative structures for an
>>> environment?
>> The former.
>>> If the former, does this imply that a frame can contain arbitrary variables?
>> Yes, but a frame isn't an R object, it's a concept that appears in
>> descriptions, e.g. part of an environment, or the local variables
>> created during function evaluation, etc.
>>> And "pointer"? Is that a type of thing in R?
>> No, there are no pointers in R. There are a couple of tricks to fake
>> them (e.g. environment objects aren't copied when assigned, you just get
>> a new reference to the same environment; this allows you to construct
>> something like a pointer by wrapping an object in an environment), but I
>> don't recommend using these routinely.
>
> Nevertheless, the statement is true. R is implemented using pointers.
Yes, definitely. I misread the original posting, and didn't notice that
the "pointer" question was connected to the previous quote.
Duncan Murdoch
More information about the R-help
mailing list