5

Given an environment object e:

> e
<environment: 0x10f0a6e98>
> class(e)
[1] "environment"

How do you access the variables inside the environment?

Just in case you're curious, I have found myself with this environment object. I didn't make it, a package in Bioconductor made it. You can make it, too, using these commands:

library('GEOquery')
eset <- getGEO("GSE4142")[[1]]
e <- assayData(eset)
jogo
  • 12,469
  • 11
  • 37
  • 42
Mike Dewar
  • 10,945
  • 14
  • 49
  • 65
  • any ideas for how I could find information like this on the net, without having to bother live people, would also be helpful. Searching for "R x" where x is whatever I'm stuck on today is consistently sucking. For example, the vanilla R documentation on environments doesn't help me all that much. – Mike Dewar Apr 13 '10 at 14:57
  • Start e.g at the rseek.org website for R-only websearches. – Dirk Eddelbuettel Apr 13 '10 at 15:20
  • I second Dirk's suggestion -- be sure to check out the "support lists" tab in the rseek.org results, since much useful info can be gleaned from mailing lists. For plain old google searches, throwing in "r-help" as a keyword is also likely to return archived mailing list results. Alternatively, go to http://tolstoy.newcastle.edu.au/R/ to search the mailing list archives directly. – Leo Alekseyev Apr 13 '10 at 17:29

1 Answers1

4

ls(e) gives you names of objects in the environment and e$name_of_object gives you specified object (or e[["a"]], or get("a",e)).

Marek
  • 49,472
  • 15
  • 99
  • 121
  • awesome. Thanks very much! Any ideas why an environment would be used over some other sort of container? Seems like a lot of effort to get the same effect as a list... – Mike Dewar Apr 13 '10 at 15:39
  • 1
    An environment is a reference - so using environments gives you mutable objects. – hadley Apr 13 '10 at 16:51