Re: [Rd] Fwd: Understanding R's "Environment" concept

From: Davor Cubranic <>
Date: Mon, 18 Jul 2011 13:58:53 -0700

On 2011-07-18, at 11:52 AM, Nipesh Bajaj wrote:

> Hi all, I am trying to understand the R's "environment" concept
> however the underlying help files look quite technical to me. Can
> experts here provide me some more intuitive ideas behind this concept
> like, why it is there, what exactly it is doing in R's architecture
> etc.?

The "official" definition in the language manual ( is quite technical, but this sentence makes intuitive sense as well:

    When R looks up the value for a symbol the frame is examined and if a matching symbol is found its value will be returned.

In other words, the environment holds all the defined values (variables, functions, etc.) and lets you refer to them by name. When you assign a value to a variable, say "x <- 10", this is stored in the environment. Then when the program is executed, when you refer to the name "x", it is looked up in the environment and replaced by its value there. (The reality is a little more complicated than that, but this is a close enough simplification.)

As for "why and what it's doing there", you will need to understand some programming language concepts first -- I don't think it's possible to explain this "non-technically".

Davor mailing list Received on Mon 18 Jul 2011 - 21:01:19 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Mon 18 Jul 2011 - 22:00:10 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive