Dear richard,
                        Bulls eye! thanks for your pointed reply...!

THanking you,
Yours sincerely,
AKSHAY M KULKARNI
________________________________
From: Richard O'Keefe <rao...@gmail.com>
Sent: Wednesday, April 5, 2023 10:30 AM
To: akshay kulkarni <akshay...@hotmail.com>
Cc: R help Mailing list <r-help@r-project.org>
Subject: Re: [R] on lexical scoping....

R *does* search the environment stack.

> search()
[1] ".GlobalEnv"        "package:stats"     "package:graphics"
[4] "package:grDevices" "package:utils"     "package:datasets"
[7] "package:methods"   "Autoloads"         "package:base

What you seem to be missing is that a package may contain
bindings that it does not export, as the wording of this
error message reminds us:
> utils::y
Error: 'y' is not an exported object from 'namespace:utils'

So when package/namespace goes onto the environment stack,
it's only the *exported* bindings that become visible.



On Wed, 5 Apr 2023 at 01:56, akshay kulkarni 
<akshay...@hotmail.com<mailto:akshay...@hotmail.com>> wrote:
Dear Members,
                             I have the following code typed at the console 
prompt:

y   <-   x*10

X has not been defined and the above code throws an object not found error. 
That is, the global environment does not contain x. Why doesn't it look further 
in the environment stack, like that of packages? There are thousands of 
packages that contain the variable named  x. Of course, that happens if the 
above code is in a function (or does it?).

What concept of R is at work in this dichotomy?

THanking you,
Yours sincerely,
AKSHAY M KULKARNI

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org<mailto:R-help@r-project.org> mailing list -- To 
UNSUBSCRIBE and more, see
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.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to