Don't think you can do that but you could respecify your function
so that the assigned variable must appear as the first argument:
foo <- function(y, arg) {
y <- substitute(y)
if (is.name(y)) assign(deparse(y), arg+1, parent.frame())
else cat("not assigned\n")
invis
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
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?
For example:
x <- foo(arg1)
so, inside foo() I'd like to be able to get the string "x".
if,
foo(arg1)