[R] Call dynamic functions

deivit david.cassany at transmuralbiotech.com
Fri Jan 27 11:45:05 CET 2012


WoW Peter!

That worked like charm. I earn you some hours of my time :)

Thanks a lot!

On Jan 27, 2012, at 10:14 , deivit wrote:

> Hi all,
>
> Does anybody know a better way to call functions than using 'eval'?
>
> I need to call functions which it's name is stored in a variable. Right
> now
> create the command string I'd like to run and then I run it using "eval".
>
> Running functions inside "eval" is starting annoying because it leads to a
> difficult error handling and difficult scenario to debug. So that I am
> asking if there is someone that knows and easier way to do that.


>>Well,

>> > fortune(106)

>>If the answer is parse() you should usually rethink the question.
>>  -- Thomas Lumley
>>     R-help (February 2005)
>>
>>
>>so how did you get yourself into that predicament in the first place? That
being said, there are options like
>>
>>f <- get(funname, mode="function")
>>f(arguments)
>>
>>or
>>
>>call(funname, arglist)
>>
>>which may or may not do it for you.


--
View this message in context: http://r.789695.n4.nabble.com/Call-dynamic-functions-tp4332942p4333083.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list