Re: [R] name of the variable that will contain the result of a function

From: Thomas Lumley <>
Date: Wed, 06 Jun 2007 07:31:56 -0700 (PDT)

On Wed, 6 Jun 2007, Benilton Carvalho wrote:

> Hi everyone,
> say I have a function called 'foo', which takes the argument arg1.
> Is there any mechanism that I can use to "learn" about the variable
> where foo(arg1) is going to be stored?

No. This information isn't available explicitly even at the C level.

> For example:
> x <- foo(arg1)
> so, inside foo() I'd like to be able to get the string "x".
> if,
> foo(arg1)
> was used insted, I'd like to get NA.

It could be much worse that this, for example,

    x[[7]][y][[4]] <- foo(arg1)
    w <- foo(arg2)+1
    names(x)[foo(arg3)] <- foo(arg4)

         -thomas mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 06 Jun 2007 - 15:16:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Jun 2007 - 15:31:43 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.