Re: [R] Concepts question: environment, frame, search path

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Wed, 02 May 2007 06:56:34 -0400

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



R-help_at_stat.math.ethz.ch mailing list
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. Received on Wed 02 May 2007 - 11:20:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 May 2007 - 12:31:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.