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

______________________________________________
R-help@r-project.org mailing list
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