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

2007-06-06 Thread Gabor Grothendieck
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

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

2007-06-06 Thread Thomas Lumley
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

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

2007-06-06 Thread Benilton Carvalho
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)