From murdoch.duncan at gmail.com  Fri May 14 19:53:18 2010
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Fri, 14 May 2010 13:53:18 -0400
Subject: [Rd] Restrict access to variables in parent environment
In-Reply-To: <AANLkTine-6pPbbOKspjOxOFF7qYC56KItUn_apBUKSgy@mail.gmail.com>
References: <AANLkTine-6pPbbOKspjOxOFF7qYC56KItUn_apBUKSgy@mail.gmail.com>
Message-ID: <4BED8E0E.5040704@gmail.com>

On 14/05/2010 10:14 AM, thmsfuller066 at gmail.com wrote:
> Hello All,
>
> By default, a reference of a variable in a function cause R to look
> for the variable in the parent environment if it is not available in
> the current environment (without generating any errors or warnings).
> I'm wondering if there is a way to revert this behaviors, such that it
> will not look for the parent environment and will generate an error if
> the variable is not available in the current environment. Is this
> tuning has to be done at the C level?

You could do that by setting the environment of the function to 
emptyenv(), but it will not be pretty.  Remember that everything in R is 
an object, so you won't have access to the base level objects like +, or 
mean, or any other function.

Duncan Murdoch



[Rd] Restrict access to variables in parent environment
Duncan Murdoch