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

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Mon, 18 Jul 2011 15:14:17 -0600

Here is an attempt at the general concept without getting technical.

How many people in the world answer to the name/title "Dad"?

Yet based on context we can usually tell who someone is talking about when they use "Dad".

It is the same in programming, I may write a function which includes a variable named "length", but my function may call another function that also uses a variable named "length" which could be very different from my "length", the user that calls my function may have their own variable called "length". How is the computer to know which "length" to use when (and not replace the user's "length" with the one in the function)? By context of the functions, which context is called environments. Each function has its own environment and will create and use variables within that environment without affecting variables of the same name in other environments.

Environments can be used for other things as well, but that starts getting more technical.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
801.408.8111



> -----Original Message-----
> From: r-devel-bounces_at_r-project.org [mailto:r-devel-bounces_at_r-
> project.org] On Behalf Of Nipesh Bajaj
> Sent: Monday, July 18, 2011 12:52 PM
> To: r-devel_at_r-project.org
> Subject: [Rd] Fwd: Understanding R's "Environment" concept
>
> *********Initially, I posted this topic in R-help however, folks there
> suggested me to post this in R-devel forum. Here is my
> problem*********
>
>
> 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.?
>
> I mainly need some non-technical intuitive explanation.
>
> Thanks,
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 18 Jul 2011 - 21:16:03 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:20:10 GMT.

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

list of date sections of archive