Re: [R] R equivalent to funcall?

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Fri 18 Mar 2005 - 00:46:33 EST

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

>Dear all,
>I have a list of time series and want to plot them.
>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. For example,

opts <- list(cex=2, lty=3, type='b')

do.call("plot", c(list(1:10, rnorm(10)), opts))

This messes up some of the tricks plot() uses to set default axis labels, but otherwise it may be close to what you're after.

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 00:51:55 2005

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