[R] Objects within environment

Megh Dal megh700004 at yahoo.com
Wed Jul 21 18:27:03 CEST 2010


Hi Duncan, thanks for your clarification. However I do not think I could really understand the "envir" argument in objects() function.....

It is saying "an alternative argument for name........" Is the "alternative" means the alternative of, let say, "package:graphics" (which is the name of an environment?). Can you give me an example of an alternative argument of that particular environment?

This is "specifying the environment evaluation environment." What does the phase "environment evaluation environment" mean? Can you give me an example?

"Mostly there for back compatibility": again totally in dark, what does it mean for "back compatibility?" An example would definitely be great.

Toy said "you need to give an environment, not the name of one". If I call someone I need to call with his name, right? Then if I need to give an environment then, without its name how can I do so?

Can you please explain me in simple english? I think R help file should use more non-technical simple english language so that student like me can understand R in more easier way!

--- On Wed, 7/21/10, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:

> From: Duncan Murdoch <murdoch.duncan at gmail.com>
> Subject: Re: [R] Objects within environment
> To: "Megh Dal" <megh700004 at yahoo.com>
> Cc: r-help at stat.math.ethz.ch
> Date: Wednesday, July 21, 2010, 4:48 PM
> On 21/07/2010 5:57 AM, Megh Dal
> wrote:
> > Hi all, I have following environments loaded with my
> current R session:
> > 
> >> search()
> > [1] ".GlobalEnv"       
> "package:stats" 
>    "package:graphics" 
> "package:grDevices"
> > [5] "package:utils" 
>    "package:datasets" 
> "package:methods"   "Autoloads"   
>     [9] "package:base"    
> > How can I find the objects under a specific
> environment? Here I tries following:
> > 
> >> objects(envir="package:base")
> > Error in objects(envir = "package:base") : invalid
> 'envir' argument
> > 
> > It would be great if somebody would point me the
> correct arguments for object() function to find the onjects
> associated with it. In help file it is written that:
> > " envir: an alternative argument to ‘name’ for
> specifying the
> >       
>    environment evaluation environment. Mostly
> there for back
> >       
>    compatibility"
> > What is the wrong in my code?
> 
> The easiest way to pick an item from the search list is by
> number:
> 
> objects(3)
>  or
> ls(3)
> 
> will give you the objects in the graphics package, with the
> search list as above.  You can also specify the name as
> the name argument, e.g.
> 
> objects("package:base")
> 
> If you want to use the envir argument (why?), you need to
> give an environment, not the name of one.
> 
> Duncan Murdoch
> 
> 






More information about the R-help mailing list