Re: [R] R equivalent to funcall?

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Fri 18 Mar 2005 - 10:24:43 EST

On Thu, 17 Mar 2005 15:11:50 +0100 (CET), Johannes Hüsing <johannes@huesing.name> wrote :

>
>> On Thu, 17 Mar 2005 13:20:32 +0100 (CET), Johannes Hüsing
>> <johannes@huesing.name> wrote :
>[...]
>>>Is there a way that the dot-dot-dot argument of a
>>>function accepts a list as single arguments, such
>>>as funcall in several Lisp dialects?
>>
>> do.call() comes close to what you want.
>[...]
>
>Indeed it does. Thank you very much. I have overlooked
>that function.

Here's a variation on my suggestion from Luke Tierney that preserves the special handling of the x and y arguments to plot():

> opts <- list(cex=2, lty=3, type='b')
> do.call(function(...) plot(1:10,rnorm(10),...), opts)

Duncan Murdoch



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Mar 18 10:30:50 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:51 EST