[R] getAnywhere

Gabor Grothendieck ggrothendieck at gmail.com
Wed Oct 15 00:26:06 CEST 2008


Try this:

do.call(getAnywhere, list(name))


On Tue, Oct 14, 2008 at 6:02 PM, Bastian A. <bastianra at gmail.com> wrote:
> Hi List,
>
> I am trying to look up an object using getAnywhere, where the object I
> am looking for is given by the _value_ of the variable I am looking
> for. Since getAnywhere calls substitue on its argument it is looking
> for an object with the name of the argument not its value. Is there a
> way to work around this, or do I have to make my own getAnywhere
> without the substitute?
>
> This is an example to clarify things:
>> a <- 1
>> name = "a"
>> getAnywhere(name) # the intend here is to find the object a with value 1 not the object name with value a
> A single object matching 'name' was found
> It was found in the following places
>  .GlobalEnv
> with value
>
> [1] "a" # I'd like to see a 1 here the value of a
>
>
>
> Regards,
> Bastian
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list