Re: [R] Function assignment

2014-07-28 Thread Jeff Newmiller
n get nicely the name inside the bracket (x["name"] <- ) >it seemed possible to get "name" some how out of an name <- >assignment. > >Again thank you very much for hints and advice. > > > >Florian Ryan >florian.r...@aim.com > > > > >

Re: [R] Function assignment

2014-07-28 Thread Florian Ryan
lorian.r...@aim.com -Original Message- From: peter dalgaard To: Jeff Newmiller Cc: Florian Ryan ; r-help Sent: Sat, Jul 26, 2014 10:04 pm Subject: Re: [R] Function assignment On 26 Jul 2014, at 17:01 , Jeff Newmiller wrote: > What an awful idea... that would lead to incredib

Re: [R] Function assignment

2014-07-26 Thread peter dalgaard
On 26 Jul 2014, at 17:01 , Jeff Newmiller wrote: > What an awful idea... that would lead to incredibly hard-to-debug programs. > No, you cannot do that. What kind of problem has led you to want such a > capability? Perhaps we can suggest a simpler way to think about your problem. I agree that

Re: [R] Function assignment

2014-07-26 Thread MacQueen, Don
Here is one way: foo <- function(tmp) assign( tmp, tmp , '.GlobalEnv') > foo('ick') > ick [1] "ick" Note that you must only use it with a character argument: > foo(1) Error in assign(tmp, tmp, ".GlobalEnv") : invalid first argument Be warned also that assign() should be used very carefully,

Re: [R] Function assignment

2014-07-26 Thread Jeff Newmiller
What an awful idea... that would lead to incredibly hard-to-debug programs. No, you cannot do that. What kind of problem has led you to want such a capability? Perhaps we can suggest a simpler way to think about your problem. ---

[R] Function assignment

2014-07-26 Thread Florian Ryan
Hello, I would like to use the variable name which i assign the return value of a function in a function. Is that possible? e.g. foo <- function(){ some not to me known R magic } myVariableName <- foo() myVariableName [1] "myVariableName" Hope someone can help me. Thanks Florian [